OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/testharness.js"></script> | |
3 <script src="../../../resources/testharnessreport.js"></script> | |
4 <style> | |
5 #c { | |
6 pointer-events: all; | |
7 } | |
8 #e { | |
9 visibility: collapse; | |
10 } | |
11 </style> | |
12 <div id="a"> | |
13 <div id="b"> | |
14 <div id="c"> | |
15 <div id="d"> | |
16 <div id="e"> | |
17 <div id="f"> | |
meade_UTC10
2016/07/13 07:29:12
Is it necessary to do so many levels of nesting he
sashab
2016/07/14 05:08:41
That's a good question! Added comments to explain
| |
18 </div> | |
19 </div> | |
20 </div> | |
21 </div> | |
22 </div> | |
23 </div> | |
24 <script> | |
25 test(function(t) | |
26 { | |
27 if (!window.internals) | |
28 assert_unreached('This test requires window.internals.'); | |
29 | |
30 a.offsetTop; // Force recalc. | |
31 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0); | |
32 | |
33 assert_equals(getComputedStyle(a).pointerEvents, "auto"); | |
34 assert_equals(getComputedStyle(b).pointerEvents, "auto"); | |
35 assert_equals(getComputedStyle(c).pointerEvents, "all"); | |
36 assert_equals(getComputedStyle(d).pointerEvents, "all"); | |
37 assert_equals(getComputedStyle(e).pointerEvents, "all"); | |
38 assert_equals(getComputedStyle(f).pointerEvents, "all"); | |
39 assert_equals(getComputedStyle(a).visibility, "visible"); | |
40 assert_equals(getComputedStyle(b).visibility, "visible"); | |
41 assert_equals(getComputedStyle(c).visibility, "visible"); | |
42 assert_equals(getComputedStyle(d).visibility, "visible"); | |
43 assert_equals(getComputedStyle(e).visibility, "collapse"); | |
44 assert_equals(getComputedStyle(f).visibility, "collapse"); | |
45 | |
46 a.offsetTop; // Force recalc. | |
47 a.style.pointerEvents = "none"; | |
48 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
49 | |
50 a.offsetTop; // Force recalc. | |
51 a.style.visibility = "hidden"; | |
52 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
53 | |
54 assert_equals(getComputedStyle(a).pointerEvents, "none"); | |
55 assert_equals(getComputedStyle(b).pointerEvents, "none"); | |
56 assert_equals(getComputedStyle(c).pointerEvents, "all"); | |
57 assert_equals(getComputedStyle(d).pointerEvents, "all"); | |
58 assert_equals(getComputedStyle(e).pointerEvents, "all"); | |
59 assert_equals(getComputedStyle(f).pointerEvents, "all"); | |
60 assert_equals(getComputedStyle(a).visibility, "hidden"); | |
61 assert_equals(getComputedStyle(b).visibility, "hidden"); | |
62 assert_equals(getComputedStyle(c).visibility, "hidden"); | |
63 assert_equals(getComputedStyle(d).visibility, "hidden"); | |
64 assert_equals(getComputedStyle(e).visibility, "collapse"); | |
65 assert_equals(getComputedStyle(f).visibility, "collapse"); | |
66 | |
67 a.offsetTop; // Force recalc. | |
68 d.style.pointerEvents = "painted"; | |
69 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
70 | |
71 a.offsetTop; // Force recalc. | |
72 e.style.visibility = "visible"; | |
73 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); | |
74 | |
75 assert_equals(getComputedStyle(a).pointerEvents, "none"); | |
76 assert_equals(getComputedStyle(b).pointerEvents, "none"); | |
77 assert_equals(getComputedStyle(c).pointerEvents, "all"); | |
78 assert_equals(getComputedStyle(d).pointerEvents, "painted"); | |
79 assert_equals(getComputedStyle(e).pointerEvents, "painted"); | |
80 assert_equals(getComputedStyle(f).pointerEvents, "painted"); | |
81 assert_equals(getComputedStyle(a).visibility, "hidden"); | |
82 assert_equals(getComputedStyle(b).visibility, "hidden"); | |
83 assert_equals(getComputedStyle(c).visibility, "hidden"); | |
84 assert_equals(getComputedStyle(d).visibility, "hidden"); | |
85 assert_equals(getComputedStyle(e).visibility, "visible"); | |
86 assert_equals(getComputedStyle(f).visibility, "visible"); | |
87 }, "Changing both pointer-events and visibility on an element, both independent inherited properties, doesn't cause a style recalc for its children."); | |
88 </script> | |
OLD | NEW |