OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 .t1 :-webkit-any(*, .dummy), | 5 #t1 + div + div + #r1, |
6 .t2 :-webkit-any(:-webkit-any(.dummy, *), .dummy), | 6 #t2 + div + div + #r2, |
7 .t3 :-webkit-any(:focus, dummy) { background-color: rgb(0, 128, 0); } | 7 #t3 + div + div + #r3 { background-color: rgb(0, 128, 0); } |
8 | |
9 #r3 { width: 10px; height: 10px } | |
10 </style> | 8 </style> |
11 <div id="t1"> | 9 <div> |
| 10 <div id="t1"></div> |
| 11 <div id="i1"></div> |
12 <div id="r1"></div> | 12 <div id="r1"></div> |
| 13 <div></div> |
13 </div> | 14 </div> |
14 <div id="t2"> | 15 <div> |
| 16 <div id="i2"></div> |
| 17 <div></div> |
15 <div id="r2"></div> | 18 <div id="r2"></div> |
| 19 <div></div> |
16 </div> | 20 </div> |
17 <div id="t3"> | 21 <div> |
18 <div id="r3" tabIndex="1"></div> | 22 <div id="t3"></div> |
| 23 <div></div> |
| 24 <div id="d3"></div> |
| 25 <div></div> |
| 26 <div id="r3"></div> |
| 27 <div></div> |
19 </div> | 28 </div> |
20 <script> | 29 <script> |
| 30 'use strict'; |
21 document.body.offsetTop; | 31 document.body.offsetTop; |
22 | 32 |
23 test(function() { | 33 test(function() { |
| 34 var i1 = document.getElementById('i1'); |
| 35 var r1 = document.getElementById('r1'); |
24 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 36 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
25 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 37 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
26 | 38 |
27 t1.className = "t1"; | 39 i1.parentNode.insertBefore(document.createElement('div'), i1); |
28 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Subt
ree style recalc"); | 40 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); |
29 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 41 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
30 }, ":-webkit-any() with universal selector"); | 42 }, "Insert between siblings"); |
31 | 43 |
32 test(function() { | 44 test(function() { |
| 45 var i2 = document.getElementById('i2'); |
| 46 var r2 = document.getElementById('r2'); |
33 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 47 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
34 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 48 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
35 | 49 |
36 t2.className = "t2"; | 50 var t2 = document.createElement('div'); |
37 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Subt
ree style recalc"); | 51 t2.id = 't2'; |
| 52 i2.parentNode.insertBefore(t2, i2); |
| 53 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt
ree style recalc"); |
38 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 54 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
39 }, "Nested :-webkit-any() with universal selector"); | 55 }, "Insert before siblings"); |
40 | 56 |
41 test(function() { | 57 test(function() { |
| 58 var d3 = document.getElementById('d3'); |
| 59 var r3 = document.getElementById('r3'); |
42 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 60 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 61 assert_true(!!window.eventSender, "This test only works with eventSender pre
sent"); |
43 | 62 |
44 r3.focus(); | 63 d3.parentNode.removeChild(d3); |
45 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 64 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
| 65 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 66 }, "Remove between siblings"); |
46 | 67 |
47 t3.className = "t3"; | |
48 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Subt
ree style recalc"); | |
49 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | |
50 }, ":-webkit-any() with universal :focus selector"); | |
51 </script> | 68 </script> |
OLD | NEW |