OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html><body> | 2 <html><body> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 | 4 |
5 <p>When we modify host children and get distributed nodes in nested ShadowDOM, d
istribution should occur from the host.</p> | 5 <p>When we modify host children and get distributed nodes in nested ShadowDOM, d
istribution should occur from the host.</p> |
6 | 6 |
7 <div id="container"> | 7 <div id="container"> |
8 <div id="host1"></div> | 8 <div id="host1"></div> |
9 </div> | 9 </div> |
10 <pre id="console"></pre> | 10 <pre id="console"></pre> |
(...skipping 25 matching lines...) Expand all Loading... |
36 setTimeout(function() { | 36 setTimeout(function() { |
37 debug('Adds a div to ShadowRoot.'); | 37 debug('Adds a div to ShadowRoot.'); |
38 addedDiv = document.createElement('div'); | 38 addedDiv = document.createElement('div'); |
39 shadowRoot11.appendChild(addedDiv); | 39 shadowRoot11.appendChild(addedDiv); |
40 shouldBe('content.getDistributedNodes().length', '2'); | 40 shouldBe('content.getDistributedNodes().length', '2'); |
41 shouldBe('content.getDistributedNodes().item(0)', 'div1'); | 41 shouldBe('content.getDistributedNodes().item(0)', 'div1'); |
42 shouldBe('content.getDistributedNodes().item(1)', 'addedDiv'); | 42 shouldBe('content.getDistributedNodes().item(1)', 'addedDiv'); |
43 debug(''); | 43 debug(''); |
44 | 44 |
45 | 45 |
46 debug('Adds a div as fallback content'); | 46 debug('Adds a div as fallback content, which should not be used.'); |
47 anotherAddedDiv = document.createElement('div'); | 47 anotherAddedDiv = document.createElement('div'); |
48 shadow1.appendChild(anotherAddedDiv); | 48 shadow1.appendChild(anotherAddedDiv); |
49 shouldBe('content.getDistributedNodes().length', '3'); | 49 shouldBe('content.getDistributedNodes().length', '2'); |
50 shouldBe('content.getDistributedNodes().item(0)', 'div1'); | 50 shouldBe('content.getDistributedNodes().item(0)', 'div1'); |
51 shouldBe('content.getDistributedNodes().item(1)', 'anotherAddedDiv'); | 51 shouldBe('content.getDistributedNodes().item(1)', 'addedDiv'); |
52 shouldBe('content.getDistributedNodes().item(2)', 'addedDiv'); | |
53 debug(''); | 52 debug(''); |
54 | 53 |
55 debug('Removes the first added div'); | 54 debug('Removes the first added div'); |
56 addedDiv.remove(); | 55 addedDiv.remove(); |
57 shouldBe('content.getDistributedNodes().length', '2'); | 56 shouldBe('content.getDistributedNodes().length', '1'); |
58 shouldBe('content.getDistributedNodes().item(0)', 'div1'); | 57 shouldBe('content.getDistributedNodes().item(0)', 'div1'); |
59 shouldBe('content.getDistributedNodes().item(1)', 'anotherAddedDiv'); | |
60 debug(''); | 58 debug(''); |
61 | 59 |
62 debug('Removes the second added div'); | 60 debug('Removes the second added div'); |
63 anotherAddedDiv.remove(); | 61 anotherAddedDiv.remove(); |
64 shouldBe('content.getDistributedNodes().length', '1'); | 62 shouldBe('content.getDistributedNodes().length', '1'); |
65 shouldBe('content.getDistributedNodes().item(0)', 'div1'); | 63 shouldBe('content.getDistributedNodes().item(0)', 'div1'); |
66 debug(''); | 64 debug(''); |
67 | 65 |
68 container.innerHTML = ""; | 66 container.innerHTML = ""; |
69 finishJSTest(); | 67 finishJSTest(); |
70 }, 0); | 68 }, 0); |
71 </script> | 69 </script> |
72 </body></html> | 70 </body></html> |
OLD | NEW |