W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2019

Re: [csswg-drafts] [css-highlight-api] Inline styles for HighlightRangeGroups should apply on top of styles provided by ::highlight (#4588)

From: Florian Rivoal via GitHub <sysbot+gh@w3.org>
Date: Mon, 16 Dec 2019 08:34:20 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-565958811-1576485259-sysbot+gh@w3.org>
More specifically, I think the way we should solve this is by:

0. Droping the [`style` attribute on HighlightRangeGroup]()
1. Extending the [CSSPseudoElement interface](https://drafts.csswg.org/css-pseudo-4/#CSSPseudoElement-interface)
    ```WebIDL
    [Exposed=Window]
    partial interface CSSPseudoElement {
        attribute CSSStyleDeclaration style;
    };
    ```
2. Defining this style attribute on the pseudo element to be a **style attribute** in the sense of [css-style-attr](https://www.w3.org/TR/css-style-attr/) and as handled in [css-cascade](https://drafts.csswg.org/css-cascade/)
3. Extending the [**type** defined in css-pseudo-4](https://drafts.csswg.org/css-pseudo-4/#dom-csspseudoelement-type) to also accept `::highlight(<name>)` in addition to the `::before`, `::after`, and `::marker` so that you can use `someElement.pseudo("::highlight(foo)"`

This would give us:
* the ability to style a custom highlight entirely from Javascript (same as original MS explainer and current spec)
* the ability to do so in a way that takes precedence over styles defined in a stylesheet (same as original MS explainer, different from current spec)
* The ability to chose whether this style applies to the entire highlight (`document.documentElement.pseudo("::highlight(foo)").style.cssText="color: pink"`) or to the section of it that is originating from a particular element  (`document.getElementById("id").pseudo("::highlight(foo)").style.cssText="color: pink"`) (new ability)
* a fully defined model for how this works, consistent with the rest of the platform, and answering questions such as inheritance as raised in #4602, or `var()` or `attr()` or `currentColor`, or interaction with animations, etc... (not previously defined in riginal MS explainer or current spec)

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4588#issuecomment-565958811 using your GitHub account
Received on Monday, 16 December 2019 08:34:22 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:57 UTC