Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src='../resources/testharness.js'></script> | |
| 3 <script src='../resources/testharnessreport.js'></script> | |
| 4 <script src='../fast/dom/shadow/resources/shadow-dom.js'></script> | |
| 5 <script src='resources/shadow-dom.js'></script> | |
|
kochi
2016/04/04 09:22:42
Can you remove line 4-5?
I don't see any function
yuzuchan
2016/04/05 04:25:23
Done.
| |
| 6 <div id="log"></div> | |
| 7 <div id="host"></div> | |
| 8 <script> | |
| 9 | |
| 10 var host = document.getElementById('host'); | |
| 11 host.attachShadow({mode: 'open'}); | |
| 12 var orphan1 = document.createElement('div'); | |
| 13 | |
| 14 test(function() { | |
| 15 assert_false(orphan1.isConnected); | |
| 16 }, 'isConnected of detached node should be false.'); | |
| 17 | |
| 18 test(function() { | |
| 19 host.shadowRoot.appendChild(orphan1); | |
| 20 assert_true(orphan1.isConnected); | |
| 21 }, 'When inserted into a connected shadow tree, isConnected should be true.'); | |
| 22 | |
| 23 | |
|
kochi
2016/04/04 09:22:42
nit: unnecessary newline?
I think it's okay to me
yuzuchan
2016/04/05 04:25:23
Done.
| |
| 24 test(function() { | |
| 25 var orphan2 = document.createElement('div'); | |
| 26 host.appendChild(orphan2); | |
| 27 assert_true(orphan2.isConnected); | |
| 28 }, 'When inserted into a document tree, isConnected should be true.'); | |
| 29 | |
| 30 test(function() { | |
| 31 var orphan3 = document.createElement('div'); | |
| 32 var host2 = document.createElement('div'); | |
| 33 host2.attachShadow({mode: 'open'}); | |
| 34 host2.shadowRoot.appendChild(orphan3); | |
| 35 assert_false(orphan3.isConnected); | |
|
kochi
2016/04/04 09:22:42
It's better to check all the ancestors (host2.shad
yuzuchan
2016/04/05 04:25:23
Done.
| |
| 36 }, 'When inserted into a detached tree, isConnected should be false.'); | |
| 37 | |
|
kochi
2016/04/04 09:22:42
Could you also add a test case where shadow host i
yuzuchan
2016/04/05 04:25:23
Done.
| |
| 38 </script> | |
| OLD | NEW |