[csswg-drafts] [css-scoping-1] Dynamic changes of state and attributes referenced by :host-context rules are pretty hard to handle efficiently.

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

== [css-scoping-1] Dynamic changes of state and attributes referenced by :host-context rules are pretty hard to handle efficiently. ==
In particular, there's no way to look into which shadow host is affected by a host-context selector without actually going through all the descendant shadow hosts of the element where the change is detected (and that'd be slow).

Blink supports this correctly restyling the whole subtree, link below, but I think that's pretty unfortunate, because that means that every change to any class, attribute, or any other state referenced in a host-context selector needs to do very expensive work that would otherwise be unnecessarily.

Additionally, you need to store the host-context rules out of band (outside of the shadow host style), because of the same reason, which is also not great, I think. This means that stylesheet data in shadow trees is no longer self-contained.

I was looking into implementing this (and other bits of Shadow DOM / CSS scoping) in Gecko, and I'm not opposed to taking the same approach, but I'm not sure if this is intentional or not, and I'd want it to discuss it before...

 * https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/css/RuleFeatureSet.cpp?l=187&rcl=b2f8374043f52c891a6927b28b00a1b4dcc02249

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

Received on Saturday, 28 October 2017 01:00:44 UTC