OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../resources/testharness.js"></script> | |
3 <script src="../resources/testharnessreport.js"></script> | |
4 <script src="resources/shadow-dom.js"></script> | |
5 <div id="d1"> | |
6 <template data-mode="open"> | |
7 <div id="d1_d1"> | |
8 <template data-mode="open"> | |
9 <slot id="d1_d1_s1" name="d1_d1_s1"></slot> | |
10 </template> | |
11 <slot id="d1_s1" name="d1_s1" slot="d1_d1_s1"></slot> | |
12 </div> | |
13 </template> | |
14 <div id="d2" slot="d1_s1"></div> | |
15 </div> | |
16 <script> | |
17 'use strict'; | |
18 | |
19 let n = createTestTree(d1); | |
20 removeWhiteSpaceOnlyTextNodes(n.d1); | |
21 | |
22 test(() => { | |
23 assert_array_equals(n.d1_s1.assignedNodes(), [n.d2]); | |
24 assert_array_equals(n.d1_s1.assignedNodes({'flatten': true}), [n.d2]); | |
25 | |
26 assert_array_equals(n.d1_d1_s1.assignedNodes(), [n.d1_s1]); | |
27 assert_array_equals(n.d1_d1_s1.assignedNodes({'flatten': true}), [n.d2]); | |
28 | |
29 let d3 = document.createElement('div'); | |
30 d3.setAttribute('id', 'd3'); | |
31 d3.setAttribute('slot', 'd1_s1'); | |
32 n.d1.appendChild(d3); | |
33 | |
34 assert_array_equals(n.d1_s1.assignedNodes(), [n.d2, d3]); | |
35 assert_array_equals(n.d1_s1.assignedNodes({'flatten': true}), [n.d2, d3]); | |
36 | |
37 assert_array_equals(n.d1_d1_s1.assignedNodes(), [n.d1_s1]); | |
38 assert_array_equals(n.d1_d1_s1.assignedNodes({'flatten': true}), [n.d2, d3]); | |
39 }, 'Distribution should be re-calcualted when assigned nodes of a slot in the pa
rent tree is changed'); | |
40 </script> | |
OLD | NEW |