In Blink's implementation of the :host() and :host-context() pseudo-classes, a <compound-selector-list> is accepted. This is not per spec (although it was at some point): they should accept a single <compound-selector> only.
The motivation behind this change is primarily to remove our "dynamic specificity" implementation, which adds unnecessary complexity to the selector matcher. A previous version of the spec (which allowed <compound-selector-list>) said that the specificity of :host()/:host-context() is (based on) the specificity of the argument that caused the match, in other words, the specificity of those selectors can't be "statically analyzed", but change dynamically according to what is matched. We still implement this, and it's very annoying.
Removing the option for <compound-selector-list> also automatically removes the "dynamic specificity" behavior, since then the "dynamic specificity" would then only have one argument to choose from anyway.
These counters count whenever :host() or :host-context() is parsed with more than one <compound-selector>. (I was apparently not smart enough to only count the cases where those selectors actually match something instead, which would have produced smaller numbers).CSSPseudoHostCompoundList - 0.01%
CSSPseudoHostContextCompoundList - 0.001%I've had a look at the HTTPArchive data for these two use-counters. Breakage seems very minor to me (see appendix for details). Most "offending" rules are never used (home-assistant.io and duplicates), invalid selectors (englishcentral.com and duplicates, this wouldn't even have been counted if I had been better at use-counting) or nonfatal (thyssenkrupp and duplicates). This is not really that surprising, since :host(<compound-selector-list>) won't work well cross-browser.The only case where I managed to find an actual match for any of these selectors was CSSPseudoHostCompoundList, case 12. This I2S would change the focus appearance in that case.Of course, just because I can't find it doesn't mean it's never used, but regardless my impression is that this change will not break the internet.
Note that :host-context() is not implemented in Gecko.
Appears to support :host(<compound-selector-list>) parse-time, but then selector-matching time only the first <compound-selector> is used.I commented on bug 199170, which would have the WebKit implementation move in the wrong direction. (The Chrome direction). It was resolved as INVALID shortly afterwards by the WebKit team.I filed bug 222733 to move the WebKit implementation in the right direction.Note that :host-context() is not implemented in WebKit.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/83875d38-4884-494d-95e2-2fef094e809fn%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAGH7WqEpPOvDRk5%2BxggPQrQxj%2BGGOSeUqATX6v%3DM4kroSzaoUw%40mail.gmail.com.
Bonus LGTM4. Very good risk analysis!
/Daniel
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw_nUAFjk4wSWxLFNjodEcxNRtTfO3ujHJTGyq8o_%3Dj9vA%40mail.gmail.com.