getComputedStyle-display-none-003.html (935B)
1 <!doctype html> 2 <title>style is invalidated properly as a result of attribute changes in display: none subtrees</title> 3 <link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle"> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <script src=/resources/testharness.js></script> 7 <script src=/resources/testharnessreport.js></script> 8 <style> 9 div { 10 color: red 11 } 12 .foo { 13 color: lime; 14 } 15 </style> 16 <div style="display: none"> 17 <div id="undisplayed"></div> 18 </div> 19 <script> 20 test(function() { 21 let undisplayed_style = getComputedStyle(undisplayed); 22 assert_equals(undisplayed_style.color, "rgb(255, 0, 0)"); 23 undisplayed.classList.add("foo"); 24 assert_equals(undisplayed_style.color, "rgb(0, 255, 0)"); 25 }, "getComputedStyle gets invalidated in display: none subtrees due to attribute mutations"); 26 </script>