HTMLLinkElement-disabled-007.html (1238B)
1 <!doctype html> 2 <title><link disabled>'s "explicitly enabled" state works when set explicitly back and forth</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 = true; 19 link.disabled = false; // This should make it "explicitly enabled". 20 link.onload = t.step_func_done(function() { 21 assert_applies(true); // Should apply, since it's explicitly enabled. 22 assert_false(link.disabled); 23 }); 24 document.head.appendChild(link); 25 }, "HTMLLinkElement.disabled setter sets the explicitly enabled state if toggled back and forth."); 26 </script>