HTMLStyleElement-load-event.html (1028B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>style elements fire load events properly</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <link rel="help" href="https://html.spec.whatwg.org/#update-a-style-block"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script> 10 let NUM_LOADS = 0; 11 </script> 12 <style onload="++NUM_LOADS"></style> 13 <style onload="++NUM_LOADS">:root { background-color: lime }</style> 14 <style onload="++NUM_LOADS">:root { background-color: lime }</style> <!-- Intentionally the same --> 15 <script> 16 async_test(function(t) { 17 assert_equals(document.styleSheets.length, 3, "Should expose the three stylesheets to the OM sync"); 18 assert_equals(NUM_LOADS, 0, "Should not fire load event sync"); 19 window.addEventListener("load", t.step_func_done(() => { 20 assert_equals(NUM_LOADS, 3, "Load event should've fired for all nodes"); 21 })); 22 }); 23 </script>