script-inserted-style-element.html (765B)
1 <!doctype html> 2 <title>Script-inserted style elements with "blocking=render" are render-blocking</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="support/test-render-blocking.js"></script> 6 7 <script> 8 const style = document.createElement('style'); 9 style.blocking = 'render'; 10 style.textContent = "@import url('support/target-red.css?pipe=trickle(d1)');"; 11 document.head.appendChild(style); 12 </script> 13 14 <div class="target"> 15 This should be red 16 </div> 17 18 <script> 19 test_render_blocking( 20 style, 21 () => { 22 let color = getComputedStyle(document.querySelector('.target')).color; 23 assert_equals(color, 'rgb(255, 0, 0)'); 24 }, 25 'Render-blocking stylesheet is applied'); 26 </script>