- From: Stephen Chenney via GitHub <sysbot+gh@w3.org>
- Date: Thu, 29 Aug 2024 19:56:02 +0000
- To: public-css-archive@w3.org
Yeah, simple things seem like they should work ... Start with the premise that to ever launch this we need to support the existing method, as best we can ascertain, of styling selection. That made use of custom properties to achieve a sensible highlight inheritance model, which is indeed the model we are trying to launch now. Authors would define custom properties on the elements, which would be inherited through the elements, and then use the properties in the selection. I have a write up at https://blogs.igalia.com/schenney/css-custom-properties-in-highlight-pseudos/ This existing method relies on highlights inheriting custom properties from their originating element. To understand why we decided to ignore custom properties defined on the highlight itself, consider this. <style> p { --color: blue; } p::highlight { --color: green; color: var(--color); } em { --color: red; } em::highlight { color: var(--color); } </style> <p>Some text <em>which color?</em></p> Which --color should the em highlight use? One expects properties to inherit through the highlight chain, arguing for green. But we have made a very explicit web-compat decision to inherit custom properties from originating elements, arguing for red. Managing the potential confusion was a goal, and also making implementations not-to-inefficient. The resolution is that the least confusing, most web-compat design is to inherit from originating and not allow custom properties in highlights. This fits with a broader general principle for property values in highlight pseudos: When a value depends on information not available in the highlight (font size, container size, custom properties) the information is taken from the originating element. -- GitHub Notification of comment by schenney-chromium Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9909#issuecomment-2318827339 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 29 August 2024 19:56:05 UTC