-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[selectors] New universal selector including tree-abiding pseudo-elements #4565
Comments
Alternatively, |
The use-case here seems pretty valid. I much prefer the (That is intended, right? So This also makes your "invalid" cases clearer - |
I already thought about So I'm not that convinced about |
+1 to @Loirooriol’s comment. |
The universal selector
*
is not actually that universal, since it only selects elements, but not pseudo-elements.This can be annoying. For example, some authors prefer the border-box sizing model and want to use it everywhere by default. Then they need something like
Another example is
::marker
. Someone may want to assign some styles to all markers, but::marker
alone only selects markers originated by elements, not by other pseudo-elements. So actually they will needThis may be easy to forget. Even the spec editors did! #4474
Also, currently ::marker is very restricted but in the future it may support arbitrary properties. So the 1st example may become
To avoid this nonsense, I propose adding a new kind of universal selector that also selects tree-abiding pseudo-elements. I don't care about the syntax, but let's say e.g.
**
.Then,
** { box-sizing: border-box }
would switch everything to the border-box sizing model.And
**::marker
would select all markers.Since this selector can select pseudo-elements, it should be restricted. It can only be used at the end of a complex selector, or immediately before a pseudo-element or a pseudo-class that is allowed after some tree-abiding pseudo-element. For example,
foo#bar > .baz **
is valid.**::marker
is valid because::before::marker
is valid, even if::marker::marker
is invalid.** ::marker
is invalid since there is a descendant combinator.**::before
is invalid since::before
can't appear after another pseudo-element. Alternatively, it could be a synonym of*::before
.**:hover
is valid because::before:hover
is valid**:root
is invalid since:root
can't appear after a pseudo-element. Alternatively, it could be a synonym of*:root
.Also, until #2284 is resolved,
**
shouldn't be allowed inside functions either. For example,:is(**)
is invalid.I'm not that sure if
**
should be allowed at the end of a compound selector after simple selectors, e.g.#foo**
could be#foo, #foo::before, #foo::before::marker, ...
::slotted(.bar)**
could be::slotted(.bar), ::slotted(.bar)::before, ...
The text was updated successfully, but these errors were encountered: