OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <div id="host"> |
| 5 <div id="c1"> |
| 6 <!-- To ensure the fast path is working, add children and check their styles
don't recalc. --> |
| 7 <div></div><div></div><div></div><div></div><div></div><div></div> |
| 8 </div> |
| 9 <div id="c2"></div> |
| 10 <div id="c3"></div> |
| 11 </div> |
| 12 <script> |
| 13 // The aim of this test is to expose a bug in the independent inheritance fast |
| 14 // path when using slotting with shadow trees, since we traverse the DOM in |
| 15 // tree-of-trees order, but inheritance happens in flat-tree order. |
| 16 // |
| 17 // The final tree-of-trees for this test will look like: |
| 18 // |
| 19 // <div id="host"> |
| 20 // <:shadow-root> |
| 21 // <span> |
| 22 // <slot></slot> |
| 23 // </span> |
| 24 // </:shadow-root> |
| 25 // <div id="c1"></div> |
| 26 // <div id="c2"></div> |
| 27 // </div> |
| 28 // |
| 29 // Which means the final flat tree after slotting will look like: |
| 30 // |
| 31 // <div id="host"> |
| 32 // <span> |
| 33 // <div id="c1"></div> |
| 34 // <div id="c2"></div> |
| 35 // </span> |
| 36 // </div> |
| 37 // |
| 38 // This test passes if changes in the span element propagate correctly to the |
| 39 // slotted child divs. |
| 40 test(function(t) |
| 41 { |
| 42 var shadow_root = host.attachShadow({mode: 'closed'}); |
| 43 var span = document.createElement("span"); |
| 44 span.appendChild(document.createElement("slot")); |
| 45 shadow_root.appendChild(span); |
| 46 |
| 47 assert_equals(getComputedStyle(c1).pointerEvents, "auto"); |
| 48 assert_equals(getComputedStyle(c2).pointerEvents, "auto"); |
| 49 |
| 50 host.scrollTop; // Force recalc. |
| 51 span.style.pointerEvents = "none"; |
| 52 // Only 4 elements should update: the span and the 3 child divs |
| 53 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4); |
| 54 |
| 55 assert_equals(getComputedStyle(c1).pointerEvents, "none"); |
| 56 assert_equals(getComputedStyle(c2).pointerEvents, "none"); |
| 57 |
| 58 }, "Changing pointerEvents, an independent inherited property, propagates correc
tly through slotted elements."); |
| 59 </script> |
| 60 |
| 61 |
| 62 |
| 63 |
OLD | NEW |