Created attachment 8414605 [details] demo.html When using imported scoped stylesheet inside template, elements inside shadow dom sometimes aren't rendered correctly. This does not happen with inline styles. Sample code attached with video showing inconsistent rendering on repeat page refresh.
Is the plan even to support <style scoped>? See also https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/R1x18ZLS5qQ
(In reply to Olli Pettay [:smaug] from comment #5) > Is the plan even to support <style scoped>? > See also > https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/R1x18ZLS5qQ The same behavior is observed without "scoped".
As far as I know we already have scoped stylesheets implemented.
Also, as I've mentioned before, we observed the same behavior even without scoped.
I've got a fix for this locally. The problem here is related to @import not working in ShadowRoot due the style sheet not being put into the document.
It seems that Bug 997173 is on the same problem. Is there anyone can confirm whether I mark that as duplicate?
(In reply to SUN Haitao from comment #11) > It seems that Bug 997173 is on the same problem. Is there anyone can confirm > whether I > mark that as duplicate? Yup. It's the same problem. William, any idea when the fix will be ready?
William told me that one of the patches in bug 992521 will fix this issue.
Not sure the patches in that bug will make <style scoped> as a child of ShadowTree work as you'd expect. Various bits of the scoped style sheet code expects the scope to be an Element (the ElementIsStyleScopeRoot flag is on Element, the array on TreeMatchContext is an array of Elements, etc.).
(But that might not be the exact issue here.) Patches in bug 1017798 should help with some aspects of scoped style interacting with shadow trees.
The testcases in this and Bug 997173 both work fine on my box now. Could this be closed?
Seems like this is fixed now (and createShadowRoot isn't what we're going to implement).