OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 #i1 ~ #i3 { color: red } |
| 6 </style> |
| 7 <div id="sandbox"> |
| 8 <div id="i1"></div> |
| 9 <div id="i2"></div> |
| 10 <div></div> |
| 11 <div></div> |
| 12 <div id="i3">This text should not be red.</div> |
| 13 </div> |
| 14 <script> |
| 15 test(() => { |
| 16 assert_true(!!window.internals, "This test only works with internals exp
osed"); |
| 17 }, "internals are exposed"); |
| 18 |
| 19 test(() => { |
| 20 assert_equals(getComputedStyle(i3).color, "rgb(255, 0, 0)", "#i3 color s
hould be red"); |
| 21 }, "#i3 red before mutations"); |
| 22 |
| 23 |
| 24 test(() => { |
| 25 sandbox.offsetTop; // Force clean style/layout. |
| 26 sandbox.removeChild(i1); |
| 27 sandbox.removeChild(i2); |
| 28 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "
#i3 should have had its style recalculated"); |
| 29 }, "#i3 recalculated"); |
| 30 |
| 31 test(() => { |
| 32 assert_equals(getComputedStyle(i3).color, "rgb(0, 0, 0)", "#i3 color sho
uld not be red"); |
| 33 }, "#i3 not red after mutations"); |
| 34 </script> |
OLD | NEW |