HTMLLinkElement-disabled-003.html (1328B)
1 <!doctype html> 2 <title><link disabled>'s "explicitly enabled" state persists after getting disconnected from the tree</title> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="author" title="Mozilla" href="https://mozilla.org"> 5 <link rel="help" href="https://html.spec.whatwg.org/#attr-link-disabled"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <link title="alt" rel="alternate stylesheet" disabled href="data:text/css,html { background: green }"> 9 <script> 10 function assert_applies(applies) { 11 (applies ? assert_equals : assert_not_equals)(getComputedStyle(document.documentElement).backgroundColor, "rgb(0, 128, 0)"); 12 } 13 14 const link = document.querySelector("link[disabled]"); 15 async_test(function(t) { 16 assert_true(link.disabled); 17 link.disabled = false; 18 assert_false(link.disabled); 19 assert_true(!link.hasAttribute("disabled")); 20 link.remove(); 21 22 link.onload = t.step_func_done(function() { 23 assert_equals(document.styleSheets.length, 1); 24 let sheet = document.styleSheets[0]; 25 assert_equals(sheet.ownerNode, link); 26 assert_applies(true); 27 }); 28 29 document.head.appendChild(link); 30 }, "HTMLLinkElement.disabled's explicitly enabled state persists when disconnected and connected again"); 31 </script>