script-created-style-element-does-not-block-script.html (700B)
1 <!DOCTYPE html> 2 <title>Script-created style element is not script-blocking</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="support/utils.js"></script> 6 <script> 7 const style = document.createElement('style'); 8 const sheet = document.createTextNode('@import url(stylesheet.py?delay=1);'); 9 style.appendChild(sheet); 10 document.head.appendChild(style); 11 </script> 12 <h1>Some text</h1> 13 <script> 14 test(() => { 15 assert_false(styleExists("h1 { color: purple; }"), 16 'stylesheet should still be pending'); 17 const h1 = document.querySelector('h1'); 18 assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)'); 19 }); 20 </script>