style-applies.html (700B)
1 <!DOCTYPE html> 2 <html> 3 <script src='/resources/testharness.js'></script> 4 <script src='/resources/testharnessreport.js'></script> 5 <body> 6 </body> 7 <script> 8 'use strict'; 9 10 promise_test(async t => { 11 const link = document.createElement("link"); 12 link.href = "data:text/css,body{background: green}"; 13 link.rel = "stylesheet"; 14 t.add_cleanup(() => link.remove()); 15 document.body.append(link); 16 const backgroundColorBefore = getComputedStyle(document.body).backgroundColor; 17 document.body.moveBefore(link, null); 18 assert_equals(getComputedStyle(document.body).backgroundColor, backgroundColorBefore); 19 }, "Moving a style inside the document should not affect whether it's applied"); 20 </script> 21 </html>