Index: LayoutTests/fast/css/style-scoped/registering-shadowroot.html |
diff --git a/LayoutTests/fast/css/style-scoped/registering-shadowroot.html b/LayoutTests/fast/css/style-scoped/registering-shadowroot.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b1c54a79fb977f1e74b3d0daec79be18f1df94e1 |
--- /dev/null |
+++ b/LayoutTests/fast/css/style-scoped/registering-shadowroot.html |
@@ -0,0 +1,70 @@ |
+<html> |
+<head> |
+ <script src="../../../resources/js-test.js"></script> |
+</head> |
+<body> |
+ <p>Test having a <style scoped> element as a direct child of a ShadowRoot.</p> |
+ <div id="host"> |
+ </div> |
+ <div id="ref"> |
+ </div> |
+ |
+ <div id="console"></div> |
+ |
+ <script> |
+ if (!window.internals) |
+ debug("windows.internals not found!"); |
+ else if (!window.internals.numberOfScopedHTMLStyleChildren) |
+ debug("windows.internals.numberOfScopedHTMLStyleChildren not found!"); |
+ else { |
+ var ref = document.getElementById('ref'); |
+ var host = document.getElementById('host'); |
+ var sr = host.createShadowRoot(); |
+ var style = document.createElement('style'); |
+ style.setAttribute('scoped', 'scoped'); |
+ |
+ debug("--- Initial ---"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <style> out of document, scoped */ |
+ |
+ debug("--- Attaching <style scoped> ---"); |
+ sr.appendChild(style); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <style> in shadow, scoped */ |
+ |
+ debug("--- Removing host ---"); |
+ host.parentNode.removeChild(host); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <style> out of document, scoped */ |
+ |
+ debug("--- Inserting host ---"); |
+ ref.parentNode.insertBefore(host, ref); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <style> in shadow, scoped */ |
+ |
+ debug("--- Unsetting @scoped ---"); |
+ style.scoped = false; |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <style> in shadow, not scoped */ |
+ |
+ debug("--- Setting @scoped ---"); |
+ style.scoped = true; |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <style> in shadow, scoped */ |
+ |
+ debug("--- Detaching <style scoped> ---"); |
+ sr.removeChild(style); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <style> out of document, scoped */ |
+ |
+ debug("--- Attaching <style scoped> under host ---"); |
+ host.appendChild(style); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "1"); |
+ shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <style> in tree, scoped */ |
+ |
+ debug("--- DONE ---"); |
+ } |
+ var successfullyParsed = true; |
+ </script> |
+</body> |
+</html> |