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

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

From: Sanket Joshi via GitHub <sysbot+gh@w3.org>
Date: Thu, 12 Dec 2019 19:40:12 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-537174957-1576179610-sysbot+gh@w3.org>
sanketj has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-highlight-api-4] Inline styles for HighlightRangeGroups should apply on top of styles provided by ::highlight ==
This section (https://drafts.csswg.org/css-highlight-api-1/#c-and-h) of the highlight API spec mentions that "the User Agent must use the styles provided in the style attribute of the corresponding highlight range group when no applicable property has been specified via ::highlight()". This seems to imply that if a ::highlight has been specified, then the ::highlight styles should "win" over those coming from the .style attribute. What was initially proposed in the highlight API explainer (https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/explainer.md#application-of-css-properties) was that "the HighlightRangeGroup object's 'inline' style (i.e. properties set directly on the .style member) will be applied on top of the cascaded values for the given highlight identifier", which is the reverse of what we currently have spec'ed.

Not sure if this was a deliberate change but I think it is important that styles set via the .style attribute apply on top of ::highlight styles. This is a useful convenience for authors to be able to override the highlight styles from script. I can see it being especially useful when combined with highlight events (https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/events-explainer.md). For example, if the author wants to change the background color of a highlight when it is clicked, it is convenient to attach a click event listener to the highlight and then set the .style attribute in the callback.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4588 using your GitHub account
Received on Thursday, 12 December 2019 19:40:14 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:18 UTC