Universal Selector Piercing Shadow Boundary... Intentionally?

369 views
Skip to first unread message

Walter Rumsby

unread,
Aug 22, 2014, 12:39:24 AM8/22/14
to polym...@googlegroups.com
As per http://jsfiddle.net/wrumsby/6uLj91e5/ we noticed that * rules pierce the shadow boundary which seems to lessen the encapsulation provided by the Shadow DOM.

I'm unsure if this is intentional, a case not considered (in Polymer or the spec) or a bug in implementation (Chrome 36.0.1985.143; Firefox 31.0).

Here's a GIF showing what happens in case this test case no longer works as described - http://g.recordit.co/hr3H3J9jM5.gif

Takayoshi Kochi

unread,
Aug 22, 2014, 1:18:48 AM8/22/14
to Walter Rumsby, polym...@googlegroups.com
Looks like this is just inheriting style ('color' property) from the shadow host (in this case, <test-element>)
to its shadow root.

.on * {
    color: red;
}

Can be applied to the shadow host element (<test-element>) as * matches any element.
Then any element under the shadow root also inherit the property.

Please try

.on * {
    border: 1px solid red;
}

instead of 'color' property.  'border' property doesn't inherit.

Each element under '.on' class will have red border, thus you should see
red border around <test-element>, but you should not see borders in
each element under the shadow root.



Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/6e3e1aba-5973-4c42-af6d-490adf6f6cb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Takayoshi Kochi
Reply all
Reply to author
Forward
0 new messages