Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!-- quirks mode --> | |
| 2 <script src="../../resources/js-test.js"></script> | |
| 3 <style> | |
| 4 #sandbox div { width: 30px; height: 30px; } | |
| 5 #sandbox > div { outline: 1px solid black; display: inline-block } | |
| 6 #sandbox a { display: block; width: 30px; height: 30px; } | |
| 7 | |
| 8 #t1 > div, #t2 > div, #t3 > div, #t4 > div, #t5 > div, #t6 > div { background-co lor: green } | |
| 9 | |
| 10 #t1 :hover, | |
| 11 #t2 :active, | |
| 12 #t3 :hover:active, | |
| 13 #t4 *:hover, | |
| 14 #t5 *:active, | |
| 15 #t6 *:active:hover { | |
| 16 background-color: red; | |
| 17 } | |
| 18 | |
| 19 #t7 :not(:hover), | |
| 20 #t8 :not(:active), | |
| 21 #t9 :hover:not(:active), | |
| 22 #t10 :not(:active):hover, | |
| 23 #t11 :active:not(:hover), | |
| 24 #t12 :not(:hover):active, | |
| 25 :hover#t13, | |
| 26 :hover.t14, | |
| 27 :hover[t15], | |
| 28 #t16:hover, | |
| 29 .t17:hover, | |
| 30 [t18]:hover, | |
| 31 #t19 :hover, | |
| 32 :active#t20, | |
| 33 :active.t21, | |
| 34 :active[t22], | |
| 35 #t23:active, | |
| 36 .t24:active, | |
| 37 [t25]:active, | |
| 38 #t26 :active { | |
| 39 background-color: green | |
| 40 } | |
| 41 </style> | |
| 42 <div id="sandbox"> | |
| 43 <span>Should stay green when hovered and/or active:</span> | |
| 44 <div id="t1"><div></div></div> | |
| 45 <div id="t2"><div></div></div> | |
| 46 <div id="t3"><div></div></div> | |
| 47 <div id="t4"><div></div></div> | |
| 48 <div id="t5"><div onclick=""></div></div> | |
| 49 <div id="t6"><div></div></div> | |
| 50 <br><span>Should be green when not hovered:</span> | |
| 51 <div id="t7"><div></div></div> | |
| 52 <br><span>Should be green when not active:</span> | |
| 53 <div id="t8"><div></div></div> | |
| 54 <br><span>Should be green when hovered and not active:</span> | |
| 55 <div id="t9"><div></div></div> | |
| 56 <div id="t10"><div></div></div> | |
| 57 <br><span>Should be green when active and not hovered:</span> | |
|
rwlbuis
2016/05/11 21:30:34
When I tried this part manually it did not work as
rune
2016/05/11 21:44:17
They will turn green when active and no longer hov
| |
| 58 <div id="t11"><div onclick=""></div></div> | |
| 59 <div id="t12"><div onclick=""></div></div> | |
| 60 <br><span>Should be green when hovered:</span> | |
| 61 <div id="t13"></div> | |
| 62 <div id="t14" class="t14"></div> | |
| 63 <div id="t15" t15></div> | |
| 64 <div id="t16"></div> | |
| 65 <div id="t17" class="t17"></div> | |
| 66 <div id="t18" t18></div> | |
| 67 <div id="t19"><a href="#" onclick="event.preventDefault()"></a></div> | |
| 68 <br><span>Should be green when active:</span> | |
| 69 <div id="t20" onclick=""></div> | |
| 70 <div id="t21" onclick="" class="t21"></div> | |
| 71 <div id="t22" onclick="" t22></div> | |
| 72 <div id="t23" onclick=""></div> | |
| 73 <div id="t24" onclick="" class="t24"></div> | |
| 74 <div id="t25" onclick="" t25></div> | |
| 75 <div id="t26"><a href="#" onclick="event.preventDefault()"></a></div> | |
| 76 </div> | |
| 77 <script> | |
| 78 description("Quirks mode - matching :hover and :active"); | |
| 79 | |
| 80 setPrintTestResultsLazily(); | |
| 81 | |
| 82 function testElement(element, whileHovering, whileActive) { | |
| 83 if (whileActive || whileHovering) { | |
| 84 hoverX = element.offsetLeft + 2; | |
| 85 hoverY = element.offsetTop + 2; | |
| 86 eventSender.mouseMoveTo(hoverX, hoverY); | |
| 87 if (whileActive) { | |
| 88 eventSender.mouseDown(); | |
| 89 } | |
| 90 if (!whileHovering) { | |
| 91 eventSender.mouseMoveTo(1, 1); | |
| 92 } | |
| 93 | |
| 94 var result = getComputedStyle(element).backgroundColor; | |
| 95 | |
| 96 if (whileActive) { | |
| 97 eventSender.mouseUp(); | |
| 98 if (!whileHovering) { | |
| 99 eventSender.mouseDown(); | |
| 100 eventSender.mouseUp(); | |
| 101 } | |
| 102 } | |
| 103 | |
| 104 return result; | |
| 105 } | |
| 106 return getComputedStyle(element).backgroundColor; | |
| 107 } | |
| 108 | |
| 109 shouldBeDefined("window.eventSender"); | |
| 110 eventSender.dragMode = false; | |
| 111 | |
| 112 var green = "rgb(0, 128, 0)"; | |
| 113 | |
| 114 shouldBe("testElement(t1.firstChild, true, false)", "green"); | |
| 115 shouldBe("testElement(t2.firstChild, true, true)", "green"); | |
| 116 shouldBe("testElement(t3.firstChild, true, true)", "green"); | |
| 117 shouldBe("testElement(t4.firstChild, true, false)", "green"); | |
| 118 shouldBe("testElement(t5.firstChild, true, true)", "green"); | |
| 119 shouldBe("testElement(t6.firstChild, true, true)", "green"); | |
| 120 shouldBe("testElement(t7.firstChild, false, false)", "green"); | |
| 121 shouldBe("testElement(t8.firstChild, false, false)", "green"); | |
| 122 shouldBe("testElement(t9.firstChild, true, false)", "green"); | |
| 123 shouldBe("testElement(t10.firstChild, true, false)", "green"); | |
| 124 shouldBe("testElement(t11.firstChild, false, true)", "green"); | |
| 125 shouldBe("testElement(t12.firstChild, false, true)", "green"); | |
| 126 shouldBe("testElement(t13, true, false)", "green"); | |
| 127 shouldBe("testElement(t14, true, false)", "green"); | |
| 128 shouldBe("testElement(t15, true, false)", "green"); | |
| 129 shouldBe("testElement(t16, true, false)", "green"); | |
| 130 shouldBe("testElement(t17, true, false)", "green"); | |
| 131 shouldBe("testElement(t18, true, false)", "green"); | |
| 132 shouldBe("testElement(t19.firstChild, true, false)", "green"); | |
| 133 shouldBe("testElement(t20, true, true)", "green"); | |
| 134 shouldBe("testElement(t21, true, true)", "green"); | |
| 135 shouldBe("testElement(t22, true, true)", "green"); | |
| 136 shouldBe("testElement(t23, true, true)", "green"); | |
| 137 shouldBe("testElement(t24, true, true)", "green"); | |
| 138 shouldBe("testElement(t25, true, true)", "green"); | |
| 139 shouldBe("testElement(t26.firstChild, true, true)", "green"); | |
| 140 | |
| 141 </script> | |
| OLD | NEW |