stylesheet-title-002.html (1498B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Test: title attribute in stylesheets not in the document tree is ignored</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="help" href="https://drafts.csswg.org/cssom/#preferred-css-style-sheet-set-name"> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-style-title"> 7 <link rel="help" href="https://github.com/w3c/webcomponents/issues/535"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <div id="host"></div> 11 <script> 12 test(function() { 13 host.attachShadow({ mode: "open" }).innerHTML = ` 14 <style> 15 div { width: 100px; height: 100px; } 16 </style> 17 <style title="Foo"> 18 div { background: purple } 19 </style> 20 <style title="Bar"> 21 div { background: green } 22 </style> 23 <div></div> 24 `; 25 assert_equals(host.shadowRoot.styleSheets.length, 3); 26 for (let sheet of host.shadowRoot.styleSheets) { 27 assert_equals(sheet.title, null, "Sheet outside of the document generates no setter"); 28 sheet.title = "Foo"; 29 assert_equals(sheet.title, null, "Mutation doesn't change the sheet title"); 30 } 31 for (let element of host.shadowRoot.querySelectorAll("style")) { 32 element.setAttribute("title", "Foo"); 33 assert_equals(element.sheet.title, null, "Attribute mutation doesn't change the sheet title"); 34 } 35 }, "Title attribute in stylesheets not in the document tree is ignored"); 36 </script>