HTMLLinkElement-disabled-006.html (1238B)
1 <!doctype html> 2 <title><link disabled>'s "explicitly enabled" state isn't magically set from the setter</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 <script> 9 function assert_applies(applies) { 10 (applies ? assert_equals : assert_not_equals)(getComputedStyle(document.documentElement).backgroundColor, "rgb(0, 128, 0)"); 11 } 12 13 async_test(function(t) { 14 const link = document.createElement("link"); 15 link.setAttribute("rel", "alternate stylesheet"); 16 link.setAttribute("title", "alt"); 17 link.href = "data:text/css,html { background: green }"; 18 link.disabled = false; // This should do nothing, and is the point of this test. 19 link.onload = t.step_func_done(function() { 20 assert_applies(false); // Should not apply, since it's an alternate that hasn't been enabled. 21 assert_false(link.disabled); 22 }); 23 document.head.appendChild(link); 24 }, "HTMLLinkElement.disabled setter does nothing if the attribute isn't present already."); 25 </script>