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='host'> | |
6 <img id="img" src="../../images/resources/test-load.jpg" slot='slot-1'> | |
kochi
2016/01/20 09:22:07
nit: please use single quote and double quote cons
yuzuchan
2016/01/20 11:07:50
Done.
| |
7 <template data-mode='open'> | |
8 <slot name='slot-1'></slot> | |
9 </template> | |
10 </div> | |
11 | |
12 <div id='host2'> | |
13 <img id="img2" src="../../images/resources/lenna.jpg" slot='slot-2'> | |
14 <template data-mode='open'> | |
15 <div id='host3'> | |
16 <div id='slot-2-parent'> | |
17 <slot name='slot-2'></slot> | |
18 </div> | |
19 <template data-mode='v0'> | |
20 <content select='#slot-2-parent'></content> | |
21 </template> | |
22 </div> | |
23 </template> | |
24 </div> | |
25 <script> | |
26 | |
27 var host = document.getElementById('host'); | |
28 convertTemplatesToShadowRootsWithin(host); | |
29 removeWhiteSpaceOnlyTextNodes(host); | |
30 document.body.offsetLeft; | |
31 | |
32 var img = document.getElementById('img'); | |
kochi
2016/01/20 09:22:07
Loading an image will make this test slower.
For e
yuzuchan
2016/01/20 11:07:50
Done.
| |
33 var slot = host.shadowRoot.querySelector('slot'); | |
34 var shadowRoot = host.shadowRoot; | |
35 var expected_array; | |
36 | |
37 img.onload = function(e) { | |
38 expected_array = [img, slot, shadowRoot, host, document.body, document.documen tElement, document]; | |
kochi
2016/01/20 09:22:07
I thought the last element in event.path would be
kochi
2016/01/20 09:39:05
I was told that "load" event is a special case tha
yuzuchan
2016/01/20 11:07:50
Done.
yuzuchan
2016/01/20 11:07:50
Done.
| |
39 test(function() { | |
40 assert_array_equals(e.path, expected_array); | |
41 }, "Triggered in a slotted element, eventPath should go through shadow tree.") ; | |
42 }; | |
43 | |
44 var img2 = document.getElementById('img2'); | |
kochi
2016/01/20 09:22:07
Same as above, could you avoid using <img>?
yuzuchan
2016/01/20 11:07:50
Done.
| |
45 var host2 = document.getElementById('host2'); | |
46 convertTemplatesToShadowRootsWithin(host2); | |
47 var srv1 = host2.shadowRoot; | |
kochi
2016/01/20 09:22:07
nit: as other ids are not abbreviated, could this
yuzuchan
2016/01/20 11:07:50
Done.
| |
48 var host3 = srv1.querySelector('#host3'); | |
49 convertTemplatesToShadowRootsWithin(host3); | |
50 var slotParent = host3.querySelector('div'); | |
51 var slot2 = host3.querySelector('slot'); | |
52 var srv0 = host3.shadowRoot; | |
53 var content = srv0.querySelector('content'); | |
54 | |
55 img2.onload = function(e) { | |
56 expected_array = [img2, slot2, slotParent, content, srv0, host3, srv1, host2, document.body, document.documentElement, document]; | |
kochi
2016/01/20 09:22:07
Same as above, could you check if the path ends in
yuzuchan
2016/01/20 11:07:50
Done.
| |
57 test(function() { | |
58 assert_array_equals(e.path, expected_array); | |
59 }, "EventPath works fine with v0 insertion points & v1 slots."); | |
60 }; | |
61 | |
kochi
2016/01/20 09:22:07
Could you also add a test that original event targ
yuzuchan
2016/01/20 11:07:50
Done.
| |
62 </script> | |
OLD | NEW |