3 ms·
Note however the different profiles (see https://drafts.csswg.org/selectors-4/#profiles https://drafts.csswg.org/selectors-4/#profiles). Notably, the dynamic pr
by gsnedders 10y ago
Note however the different profiles (see https://drafts.csswg.org/selectors-4/#profiles https://drafts.csswg.org/selectors-4/#profiles). Notably, the dynamic profile excludes :has, and that's what's expected to be used for selector matching in CSS in browsers. (:has can't be matched in a single-pass of the document with a single-node lookahead, which is something no browser vendor wants to give up.) The static profile is likely to be used by querySelector and similar.
The only thing new with :lang in Selectors 4 is wildcards (with "*"). Note that if you do want to use attribute selectors you likely want to use |= rather than just =. |= allows either the exact value or a string that starts with it followed by "-". :lang exists for similar reasons to :link—making selectors generic, so they can work with things except (X)HTML.
I don't get why you'd ever use data-lang rather than lang, though? Notably, data-lang wouldn't get passed through to the AT layer. You can use lang on any element, not just the root.
- Klathmon 10y agoDoes the profiles thing feel like a really really bad idea to anyone else? Taking CSS and splitting it into parts that can be in the stylesheet and parts that can't seems like it's only going to cause confusion, and won't really help anything. The major reason you'd want something like :has is because you want to style a parent in CSS only. Without that being in the "dynamic profile" it leaves it to JS only, which (if i'm reading things correctly) would be able to do the same thing by doing a lookup on the parent, then doing a lookup in that node for the child which would be faster than how current CSS engines would find that node if they had to start making multiple passes.
- angry-hacker 10y agoThey resist the whole parent / has selector avoidance with incremental rendering and performance issues.