script-inserted-stylesheet-link.html (799B)
1 <!doctype html> 2 <title>Script-inserted stylesheet links 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 stylesheet = document.createElement('link'); 9 stylesheet.rel = 'stylesheet'; 10 stylesheet.href = 'support/target-red.css?pipe=trickle(d1)'; 11 stylesheet.blocking = 'render'; 12 document.head.appendChild(stylesheet); 13 </script> 14 15 <div class="target"> 16 This should be red 17 </div> 18 19 <script> 20 test_render_blocking( 21 stylesheet, 22 () => { 23 let color = getComputedStyle(document.querySelector('.target')).color; 24 assert_equals(color, 'rgb(255, 0, 0)'); 25 }, 26 'Render-blocking stylesheet is applied'); 27 </script>