Closed m-akinc closed 6 months ago
@ghengeveld @JonathanKolnik π Could I get a review of this PR? I think it would open this addon up to a whole lot of new potential users that can't currently use it (like my team π).
@m-akinc I'll take a good look at this and your other PRs tomorrow. You did a lot of great work here!
I added a story for a nested custom component and one for CSS at-rules. Let me know if you need anything else before merging.
LGTM. Nice work! Ready to merge?
Yes! π
CI is failing to release, working on that...
:rocket: PR was released in v2.2.0
:rocket:
Fixes #41 and #93
CSSGroupingRule
s like@layer
,@media
, etc.shadowHosts
because of the use of__pseudoStatesRewritten
. This would prevent them from getting classes applied byshadowHosts.forEach(updateShadowHost)
.:host(.foo) .control:hover
, it was incorrectly assuming any state selectors (e.g.:hover
) occurred inside the:host()
selector and generated a bogus selector like:host(.foo) .control.pseudo-hover-all
. Now handling scenarios like this by writing:host(.foo.pseudo-hover-all) .control
instead.pseudo-*-all
classes were being applied to a custom element (by theattachShadow
override) even if none of its stylesheets were rewritten (and therefore it was not added toshadowHosts
). This could result in those classes not being removed later.updateShadowHost
was only looking at classes on ancestors, so anypseudo-*
class applied directly to the shadow host because of a selector (i.e. inapplyParameter
) would get removed.updateShadowHost
would propagatepseudo-hover
, for example, from an ancestor to a shadow host. It should only be propagatingpseudo-*-all
.updateShadowHost
wouldn't cross shadow boundaries, so nested shadow DOM (i.e. a custom element in the shadow DOM of a custom element) wouldn't get the globalpseudo-*-all
class.rewriteStyleSheet
test cases