W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

Re: [csswg-drafts] [css-cascade] What is the migration path for Cascade Layers? (#4985)

From: Miriam Suzanne via GitHub <sysbot+gh@w3.org>
Date: Mon, 11 Jan 2021 20:40:01 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-758209624-1610397599-sysbot+gh@w3.org>
The [initial syntax proposal](https://gist.github.com/mirisuzanne/4224caca74a0d4be33a2b565df34b9e7#what-is-the-migration-path-for-cascade-layers-4985) provides a path for polyfilling the proposed layer behavior with selectors:

> Since this proposal defines Cascade Layers directly above Specificity in the cascade, but below inline style attributes, it should be possible to polyfill the entire feature using ID tags to boost specificity. Most simply stated:
> 
> ```css
> #reset a { /* reset layer */ }
> #base#base a { /* base layer */ }
> #components#components#components a { /* component layer */ }
> ```
> 
> In order to avoid requiring a match with ID attributes in the HTML, that specificity can be generated using the `:is()` pseudo-class:
> 
> ```css
> :is(#r, a) { /* reset layer */ }
> :is(#b#b, a) { /* base layer */ }
> :is(#c#c#c, a) { /* component layer */ }
> ```
> 
> The reality will require some additional finesse to avoid conflicts with existing ID selectors, but those details can be left to individual polyfills.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 11 January 2021 20:40:03 UTC

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