[csswg-drafts] [css-selectors] Making the Tag-layer and ID-layer (#4690)

jensimmons has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors] Making the Tag-layer and ID-layer  ==
In an effort to modernize the CSS Cascade, and make it more suitable for projects with multiple Authors writing code over many years, @mirisuzanne is thinking about [Origins (and how we might extend their power)](https://github.com/w3c/csswg-drafts/issues/4470), and about the Specificity of Selectors. 

For context:
The [Selectors Level 4](https://www.w3.org/TR/selectors/#specificity-rules) defines three levels of sectors / three levels of specificity:
> A selector’s specificity is calculated for a given element as follows:
> count the number of ID selectors in the selector (= A)
> count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= B)
> count the number of type selectors and pseudo-elements in the selector (= C)
> ignore the universal selector

Miriam wrote:
“Specificity only has three layers, & only the middle (classes/attributes) layer is flexible enough for most use cases. IDs can only be used once per page, & tags need to be reused semantically. They're useful but very limited.

When everything is in a single layer, minute changes can have major impact. Everything relies on careful counting of selectors, and careful management of source order. Specificity should be more robust.

We need ways to create custom tag-layer – & reusable id-layer – selectors.” — Miriam [on Twitter](https://twitter.com/MiriSuzanne/status/1219289524880044032)

Let's talk about this. What would it look like to extend selectors so that:
• IDs can be used more than once per page
• The 'tag layer' has more customizability
• Other ways to empower Authors to use all three layers of specificity, instead of flattening their work into one layer.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4690 using your GitHub account

Received on Wednesday, 22 January 2020 14:30:53 UTC