Open TimvdLippe opened 6 years ago
Issue still exists: http://jsbin.com/secotoveta/edit?html,output
Experiencing this issue as well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
From @tomalec on January 10, 2018 16:10
Description
Shadow DOM styles are not scoped for vanilla JS Custom Elements and shadow DOM content does not get
style-scope my-element
class when element is cloned and stamped after CE definitionLive Demo
http://jsbin.com/sekilom/edit?html,output
Steps to Reproduce
<my-element>
my-element
in the way it attaches open shadow root inconstructor
orattributeChangedCallback
, the shadow root that contains styles and elements.Expected Results
style-scope my-element
classActual Results
style-scope my-element
classBrowsers Affected
Versions
Investigation
When element is created:
.innerHTML
, orelements get
style-scope ...
class, so are at least scopeableI tried
ShadyCSS.styleElement
with no luck. I suspect ShadyCSS assumes every custom element instance should have the same shadow root what is not true per spec and in my case. https://github.com/webcomponents/shadycss/blob/master/src/scoping-shim.js#L233 early returns early, even though my element hasshadowRoot
.Copied from original issue: webcomponents/webcomponentsjs#883