| 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 <script src="resources/shadow-dom.js"></script> | 4 <script src="resources/shadow-dom.js"></script> |
| 5 | 5 |
| 6 <div id="test1"> | 6 <div id="test1"> |
| 7 <div id="host1"> | 7 <div id="host1"> |
| 8 <template id="shadowroot" data-mode="open"> | 8 <template id="shadowroot" data-mode="open"> |
| 9 <slot id="s1" name="slot1"></slot> | 9 <slot id="s1" name="slot1"></slot> |
| 10 </template> | 10 </template> |
| 11 <div id="c1" slot="slot1"></div> | 11 <div id="c1" slot="slot1"></div> |
| 12 </div> | 12 </div> |
| 13 </div> | 13 </div> |
| 14 | 14 |
| 15 <script> | 15 <script> |
| 16 function doneIfSlotChange(slots, test) { | 16 function doneIfSlotChange(slots, test) { |
| 17 let fired = new Set(); | 17 let fired = new Set(); |
| 18 for (let slot of slots) { | 18 for (let slot of slots) { |
| 19 slot.addEventListener('slotchange', test.step_func((e) => { | 19 slot.addEventListener('slotchange', test.step_func((e) => { |
| 20 if (e.target != slot) |
| 21 return; |
| 20 assert_false(fired.has(slot.id)); | 22 assert_false(fired.has(slot.id)); |
| 21 fired.add(slot.id); | 23 fired.add(slot.id); |
| 22 if (fired.size == slots.length) { | 24 if (fired.size == slots.length) { |
| 23 test.done(); | 25 test.done(); |
| 24 } | 26 } |
| 25 })) | 27 })) |
| 26 } | 28 } |
| 27 } | 29 } |
| 28 | 30 |
| 29 async_test((test) => { | 31 async_test((test) => { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 <script> | 276 <script> |
| 275 async_test((test) => { | 277 async_test((test) => { |
| 276 let n = createTestTree(test6); | 278 let n = createTestTree(test6); |
| 277 removeWhiteSpaceOnlyTextNodes(n.test6); | 279 removeWhiteSpaceOnlyTextNodes(n.test6); |
| 278 | 280 |
| 279 doneIfSlotChange([n.s2], test); | 281 doneIfSlotChange([n.s2], test); |
| 280 | 282 |
| 281 n.s1.remove(); | 283 n.s1.remove(); |
| 282 }, "slotchange event: Even if distributed nodes do not change, slotchange should
be fired if assigned nodes are changed."); | 284 }, "slotchange event: Even if distributed nodes do not change, slotchange should
be fired if assigned nodes are changed."); |
| 283 </script> | 285 </script> |
| 286 |
| 287 <div id="test7"> |
| 288 <div id="host1"> |
| 289 <template data-mode="open"> |
| 290 <div id="host2"> |
| 291 <template data-mode="open"> |
| 292 <slot id="s3" name="slot3"></slot> |
| 293 </template> |
| 294 <slot id="s2" slot="slot3"> |
| 295 <slot id="s1" name=slot1></slot> |
| 296 </slot> |
| 297 </div> |
| 298 </template> |
| 299 <div id="c1" slot="slot1"></div> |
| 300 </div> |
| 301 </div> |
| 302 |
| 303 <script> |
| 304 async_test((test) => { |
| 305 let n = createTestTree(test7); |
| 306 removeWhiteSpaceOnlyTextNodes(n.test7); |
| 307 |
| 308 document.body.offsetLeft; |
| 309 doneIfSlotChange([n.s1, n.s2, n.s3], test); |
| 310 |
| 311 n.c1.remove(); |
| 312 }, "slotchange event: Fallback slot's parant slot is assinged to another slot.")
; |
| 313 </script> |
| OLD | NEW |