OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> |
| 4 #hovered { width: 100px; height: 100px; background-color: orange } |
| 5 #hovered::first-letter { color: lime } |
| 6 #hovered:hover { background-color: green } |
| 7 #hovered:hover + div #target { background-color: green } |
| 8 </style> |
| 9 <div id="hovered"> |
| 10 <div></div> |
| 11 <div></div> |
| 12 </div> |
| 13 <div> |
| 14 <div></div> |
| 15 <div></div> |
| 16 <div></div> |
| 17 <div></div> |
| 18 <div></div> |
| 19 <div id="target">This text, and the orange square, should have a green backg
round when the orange square is hovered.</div> |
| 20 </div> |
| 21 <script> |
| 22 description("Sibling invalidation with :hover and ::first-letter"); |
| 23 |
| 24 function hoverElement(element) { |
| 25 eventSender.mouseMoveTo(0, 0); |
| 26 document.body.offsetLeft; // force layout. |
| 27 var x = element.offsetLeft + 1; |
| 28 var y = element.offsetTop + 1; |
| 29 eventSender.mouseMoveTo(x, y); |
| 30 } |
| 31 |
| 32 var transparent = "rgba(0, 0, 0, 0)"; |
| 33 var green = "rgb(0, 128, 0)"; |
| 34 |
| 35 shouldBe("getComputedStyle(target).backgroundColor", "transparent"); |
| 36 |
| 37 shouldBeDefined("window.eventSender"); |
| 38 |
| 39 if (window.eventSender) |
| 40 hoverElement(hovered); |
| 41 |
| 42 // Recalc #hovered (1), its subtree (2) due to ::first-letter, and #target (1). |
| 43 // In total: 4. |
| 44 if (window.internals) |
| 45 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "4"); |
| 46 |
| 47 shouldBe("getComputedStyle(target).backgroundColor", "green"); |
| 48 |
| 49 </script> |
OLD | NEW |