W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2017

[csswg-drafts] [css-scoping-1] Specificity of :host and :host-context doesn't seem to be defined?

From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
Date: Sat, 28 Oct 2017 01:19:14 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-269273069-1509153553-sysbot+gh@w3.org>
emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-scoping-1] Specificity of :host and :host-context doesn't seem to be defined? ==
Which is important for cascade order.

I think there are similar issues with other selectors like `:matches` and such, but those seem to have been resolved (I think?) and now matches is defined as:

>  The specificity of a :matches() pseudo-class is replaced by the specificity of its selector list argument. (The full selector’s specificity is equivalent to expanding out all the combinations in full, without :matches().)

Anyway. Blink calculates it dynamically based on the biggest specificity of the compound selectors that match. But as far as I can tell there's no spec that defines this (sorry if I overlooked it).

There's a problem with calculating specificity dynamically, which is that doing it converts the specificity not in just a function of the selector, but also in a function of the element, which is unfortunate (specially since that affects style sharing, since you can't assume that proving you match all the same selectors you have the same style, you also need to prove you match the exact same sub-selectors).

Also, doing it in a way that is not inconsistent requires matching through all the selectors, instead of just one, which isn't particularly great, but also not a big deal I suppose.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1915 using your GitHub account
Received on Saturday, 28 October 2017 01:19:15 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:19 UTC