Re: [csswg-drafts] [css-highlight-api] maplike vs setlike (#5910)

@LeaVerou @hober @tabatkins 

The original explainer did use maplike for this (the type was originally called `HighlightMap`), and the Highlight object (originally called `HighlightRangeGroup`) would only need to be named when it was being registered. The reason this was problematic was that the same Highlight object could be registered multiple times under different names. To prevent that, we would have to override put, and either iterate the entire data structure to check if any map entry already has that Highlight as its value (which has similar performance to what we do today), or require authors to create Highlights with a name and also register with that exact same name (which doesn't seem developer friendly).

That's why we went with the current approach. If there's a better solution that we're missing, we'd love to hear it.

-- 
GitHub Notification of comment by sanketj
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5910#issuecomment-778390398 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 12 February 2021 19:06:37 UTC