OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> |
| 4 #match { background-color: red } |
| 5 #hover:hover #match { background-color: green } |
| 6 </style> |
| 7 <div id="hover"> |
| 8 Hover this text ... |
| 9 <span></span> |
| 10 <span></span> |
| 11 <span></span> |
| 12 <span></span> |
| 13 <span id="match"> and this should have a green background.</span> |
| 14 </div> |
| 15 <div id="host"></div> |
| 16 <script> |
| 17 description("Removing a shadow tree stylesheet should cause an invalidation set
update.") |
| 18 |
| 19 shouldBeDefined("window.internals"); |
| 20 shouldBeDefined("window.eventSender"); |
| 21 |
| 22 var red = "rgb(255, 0, 0)"; |
| 23 var green = "rgb(0, 128, 0)"; |
| 24 |
| 25 function hoverElement(element) { |
| 26 eventSender.mouseMoveTo(0, 0); |
| 27 document.body.offsetLeft; // force recalc. |
| 28 var x = element.offsetLeft + 1; |
| 29 var y = element.offsetTop + 1; |
| 30 eventSender.mouseMoveTo(x, y); |
| 31 } |
| 32 |
| 33 // Add and remove a ":hover *" rule from a shadow tree. |
| 34 var root = host.createShadowRoot(); |
| 35 root.innerHTML = "<style>:hover * { background-color: pink }</style>"; |
| 36 hover.offsetTop; |
| 37 root.innerHTML = ""; |
| 38 |
| 39 shouldBe("getComputedStyle(match).backgroundColor", "red"); |
| 40 |
| 41 hoverElement(hover); |
| 42 |
| 43 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); |
| 44 shouldBe("getComputedStyle(match).backgroundColor", "green"); |
| 45 |
| 46 </script> |
OLD | NEW |