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 <div id='host1'> | 5 <div id='host1'> |
6 <input id='input1' slot='slot1'> | 6 <input id='input1' slot='slot1'> |
7 <template data-mode='open'> | 7 <template data-mode='open'> |
8 <slot name='slot1'></slot> | 8 <slot name='slot1'></slot> |
9 </template> | 9 </template> |
10 </div> | 10 </div> |
(...skipping 25 matching lines...) Expand all Loading... |
36 test(function() { | 36 test(function() { |
37 var host1 = document.getElementById('host1'); | 37 var host1 = document.getElementById('host1'); |
38 convertTemplatesToShadowRootsWithin(host1); | 38 convertTemplatesToShadowRootsWithin(host1); |
39 removeWhiteSpaceOnlyTextNodes(host1); | 39 removeWhiteSpaceOnlyTextNodes(host1); |
40 document.body.offsetLeft; | 40 document.body.offsetLeft; |
41 var input1 = document.getElementById('input1'); | 41 var input1 = document.getElementById('input1'); |
42 var slot1 = host1.shadowRoot.querySelector('slot'); | 42 var slot1 = host1.shadowRoot.querySelector('slot'); |
43 var shadowRoot = host1.shadowRoot; | 43 var shadowRoot = host1.shadowRoot; |
44 input1.onfocus = function(e) { | 44 input1.onfocus = function(e) { |
45 var expected_array1 = [input1, slot1, shadowRoot, host1, document.body, docu
ment.documentElement, document, window]; | 45 var expected_array1 = [input1, slot1, shadowRoot, host1, document.body, docu
ment.documentElement, document, window]; |
46 assert_array_equals(e.deepPath(), expected_array1); | 46 assert_array_equals(e.composedPath(), expected_array1); |
47 }; | 47 }; |
48 input1.focus(); | 48 input1.focus(); |
49 }, 'Triggered in a slotted element, eventPath should go through shadow tree.'); | 49 }, 'Triggered in a slotted element, eventPath should go through shadow tree.'); |
50 | 50 |
51 test(function() { | 51 test(function() { |
52 var input2 = document.getElementById('input2'); | 52 var input2 = document.getElementById('input2'); |
53 var host2 = document.getElementById('host2'); | 53 var host2 = document.getElementById('host2'); |
54 convertTemplatesToShadowRootsWithin(host2); | 54 convertTemplatesToShadowRootsWithin(host2); |
55 var shadowRootV1 = host2.shadowRoot; | 55 var shadowRootV1 = host2.shadowRoot; |
56 var host3 = shadowRootV1.querySelector('#host3'); | 56 var host3 = shadowRootV1.querySelector('#host3'); |
57 convertTemplatesToShadowRootsWithin(host3); | 57 convertTemplatesToShadowRootsWithin(host3); |
58 var slotParent = host3.querySelector('div'); | 58 var slotParent = host3.querySelector('div'); |
59 var slot2 = host3.querySelector('slot'); | 59 var slot2 = host3.querySelector('slot'); |
60 var shadowRootV0 = host3.shadowRoot; | 60 var shadowRootV0 = host3.shadowRoot; |
61 var content = shadowRootV0.querySelector('content'); | 61 var content = shadowRootV0.querySelector('content'); |
62 | 62 |
63 input2.onfocus = function(e) { | 63 input2.onfocus = function(e) { |
64 var expected_array2 = [input2, slot2, slotParent, content, shadowRootV0, hos
t3, shadowRootV1, host2, document.body, document.documentElement, document, wind
ow]; | 64 var expected_array2 = [input2, slot2, slotParent, content, shadowRootV0, hos
t3, shadowRootV1, host2, document.body, document.documentElement, document, wind
ow]; |
65 assert_array_equals(e.deepPath(), expected_array2); | 65 assert_array_equals(e.composedPath(), expected_array2); |
66 }; | 66 }; |
67 input2.focus(); | 67 input2.focus(); |
68 }, 'EventPath works fine with v0 insertion points & v1 slots.'); | 68 }, 'EventPath works fine with v0 insertion points & v1 slots.'); |
69 | 69 |
70 test(function() { | 70 test(function() { |
71 var host4 = document.getElementById('host4'); | 71 var host4 = document.getElementById('host4'); |
72 convertTemplatesToShadowRootsWithin(host4); | 72 convertTemplatesToShadowRootsWithin(host4); |
73 var shadowRoot2 = host4.shadowRoot; | 73 var shadowRoot2 = host4.shadowRoot; |
74 var slot3 = shadowRoot2.querySelector('slot'); | 74 var slot3 = shadowRoot2.querySelector('slot'); |
75 var input3 = document.getElementById('input3') | 75 var input3 = document.getElementById('input3') |
76 var inputParent = document.getElementById('input-parent'); | 76 var inputParent = document.getElementById('input-parent'); |
77 input3.onfocus = function(e) { | 77 input3.onfocus = function(e) { |
78 var expected_array3 = [input3, inputParent, slot3, shadowRoot2, host4, docum
ent.body, document.documentElement, document, window]; | 78 var expected_array3 = [input3, inputParent, slot3, shadowRoot2, host4, docum
ent.body, document.documentElement, document, window]; |
79 assert_array_equals(e.deepPath(), expected_array3); | 79 assert_array_equals(e.composedPath(), expected_array3); |
80 }; | 80 }; |
81 input3.focus(); | 81 input3.focus(); |
82 }, 'EventPath works fine when event happens to a descendant of a slotted element
.'); | 82 }, 'EventPath works fine when event happens to a descendant of a slotted element
.'); |
83 | 83 |
84 </script> | 84 </script> |
OLD | NEW |