Re: [csswg-drafts] [css-pseudo-4] Add a pseudo-element to style all highlight pseudo-elements (#9091)

Let's assume we add support for `*` as a custom highlight ident value, aka ::highlight(*), that will apply the properties to all custom highlights.

Two things we need to decide on and include in any resolution:
* Does this match any custom highlight, include identifiers referred to when registering a highlight from script but with no matching rules? That is, would `::highlight(*)` provide properties when `CSS.highlights.set("foo", new Highlight(foo_range));` is registered. I propose YES because it would allow you to define one set of properties with `::highlight(*)` and then use idents in JS to manage different ranges that you wanted to style with those properties. Otherwise you need to repeat the styles for every ident that you wish to use.
* Are the properties from `::highlight(*)` applied as fallbacks to properties in a more specific match? I believe this is YES, and I believe it's what Bramus is getting at with specificity rules. I'm no expert on specificity, but I want the behavior to be that from the [comment above](https://github.com/w3c/csswg-drafts/issues/9091#issuecomment-2703505587) where the `*` provides properties to use when those properties are not present on a more specific `::highlight(name)`. Do we implement this as a fallback at use time (i.e. when painting highlight `foo` we look for `color` on `::highlight(foo)` and if we don't find that color, we look for color on `::highlight(*)`, otherwise we fallback as we currently do? Or at style resolution does `::highlight(foo)` inherit from its highlight parent and `::highlight(*)`? The former is what I want to implement.

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


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

Received on Tuesday, 1 April 2025 21:32:19 UTC