DescriptionKeep a separate list of :host(-context) rules.
:host and :host-context in the rightmost compound selector apply to the
host element in the parent scope of a scoped stylesheet. However, we put
all these rules into the universal rule list and collected :host rules in
its own scope and other rules in the scope outside. For example:
<custom-element>
<:shadow-root>
<style>
:host { background: green }
* { background: red; }
</style>
<custom-element></custom-element>
</custom-element>
":host" applies to the outer <custom-element>, "*" applies to the
inner one. We collected both rules for both elements.
Instead keep a list of :host and :host-context rules for each scope to be
matched for the outer scope only, and skip all other rules from the inner
scope when matching for the outer scope.
Note that selectors with :host(-context) in non-rightmost compounds are
still in the other rule lists as they don't match the shadow host, but an
element in the same scope as the stylesheet is.
For instance: ":host(.x) div".
R=kochi@chromium.org,esprehn@chromium.org
BUG=437846
TEST=fast/dom/shadow/host-pseudo-class.html
TEST=fast/dom/shadow/hostcontext-pseudo-class.html
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=187036
Patch Set 1 #
Total comments: 2
Patch Set 2 : Added tests #
Messages
Total messages: 6 (1 generated)
|