| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../resources/js-test.js"></script> | |
| 4 </head> | |
| 5 <body> | |
| 6 <p>Test having a <style scoped> element as a direct child of a ShadowR
oot.</p> | |
| 7 <div id="host"> | |
| 8 </div> | |
| 9 <div id="ref"> | |
| 10 </div> | |
| 11 | |
| 12 <div id="console"></div> | |
| 13 | |
| 14 <script> | |
| 15 if (!window.internals) | |
| 16 debug("windows.internals not found!"); | |
| 17 else if (!window.internals.numberOfScopedHTMLStyleChildren) | |
| 18 debug("windows.internals.numberOfScopedHTMLStyleChildren not found!"
); | |
| 19 else { | |
| 20 var ref = document.getElementById('ref'); | |
| 21 var host = document.getElementById('host'); | |
| 22 var sr = host.createShadowRoot(); | |
| 23 var style = document.createElement('style'); | |
| 24 style.setAttribute('scoped', 'scoped'); | |
| 25 | |
| 26 debug("--- Initial ---"); | |
| 27 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 28 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <
style> out of document, scoped */ | |
| 29 | |
| 30 debug("--- Attaching <style scoped> ---"); | |
| 31 sr.appendChild(style); | |
| 32 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 33 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <
style> in shadow, scoped */ | |
| 34 | |
| 35 debug("--- Removing host ---"); | |
| 36 host.parentNode.removeChild(host); | |
| 37 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 38 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <
style> out of document, scoped */ | |
| 39 | |
| 40 debug("--- Inserting host ---"); | |
| 41 ref.parentNode.insertBefore(host, ref); | |
| 42 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 43 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <
style> in shadow, scoped */ | |
| 44 | |
| 45 debug("--- Unsetting @scoped ---"); | |
| 46 style.scoped = false; | |
| 47 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 48 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <
style> in shadow, not scoped */ | |
| 49 | |
| 50 debug("--- Setting @scoped ---"); | |
| 51 style.scoped = true; | |
| 52 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 53 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* <
style> in shadow, scoped */ | |
| 54 | |
| 55 debug("--- Detaching <style scoped> ---"); | |
| 56 sr.removeChild(style); | |
| 57 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0"); | |
| 58 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <
style> out of document, scoped */ | |
| 59 | |
| 60 debug("--- Attaching <style scoped> under host ---"); | |
| 61 host.appendChild(style); | |
| 62 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "1"); | |
| 63 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* <
style> in tree, scoped */ | |
| 64 | |
| 65 debug("--- DONE ---"); | |
| 66 } | |
| 67 var successfullyParsed = true; | |
| 68 </script> | |
| 69 </body> | |
| 70 </html> | |
| OLD | NEW |