You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, all/most selectors support use after the universal selector.
For example…
w/ universal selector
w/o universal selector
identical targeting
*.class
.class
✅
*#id
#id
✅
*[attribute]
[attribute]
✅
*:pseudo
:pseudo
✅
*::pseudo
::pseudo
✅
*elem
elem
❌
Some advantages to allowing the universal selector to prepend tagname selectors are:
better consistency in how all selectors behave with the universal selector
easier nesting syntax agreed upon nesting syntax
Up until now, the generally accepted and voted upon nesting syntax requires wrapping a selector with something like :is() or :where() when it begins with an alpha character since that could easily be confused with a CSS property name. That can look something like this:
The text was updated successfully, but these errors were encountered:
brandonmcconnell
changed the title
Support using universal selector with tagname
[css-selectors] Support universal selector usage with tagname *tagnameFeb 1, 2023
Currently, all/most selectors support use after the universal selector.
For example…
*.class
.class
*#id
#id
*[attribute]
[attribute]
*:pseudo
:pseudo
*::pseudo
::pseudo
*elem
elem
Some advantages to allowing the universal selector to prepend tagname selectors are:
better consistency in how all selectors behave with the universal selector
easier nesting syntax agreed upon nesting syntax
Up until now, the generally accepted and voted upon nesting syntax requires wrapping a selector with something like
:is()
or:where()
when it begins with an alpha character since that could easily be confused with a CSS property name. That can look something like this:With this change to how the universal selector works next to tagnames, this same block could now be rewritten much more concisely using
*
like this:I put together a pen for this which can be used for demonstrating this proposal and also to test if/when this is implemented:
https://codepen.io/brandonmcconnell/pen/eYjYVrE
The text was updated successfully, but these errors were encountered: