[csswg-drafts] `:predefined` pseudo-class for built-ins (i.e. not custom elements) (#11001)

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

== `:predefined` pseudo-class for built-ins (i.e. not custom elements) ==
It is currently impossible to match custom elements generically. [`:not(:defined)`](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-defined) matches custom elements that have not yet been defined, but since `:defined` also matches built-ins, there is no way to target all custom elements.

Admittedly the use cases for this are niche (it came up in a Twitter discussion with a framework author who said they use a different code path when the template contains custom elements), but also itโ€™s a pretty simple addition, so why not.

We could introduce a `:predefined` pseudo-class to match native elements, authors can simply use `:not(:predefined)` to match custom elements. Or we could introduce a pseudo-class to directly match custom elements, though I have no idea what to call it ๐Ÿ™ƒ 

_(Ideally we should eventually introduce more granular selectors to target element by tag prefix and/or suffix but this is a nice quick fix that can be implemented pretty easily, and is useful in its own right.)_

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 4 October 2024 05:00:32 UTC