OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script src="resources/shadow-dom.js"></script> | 5 <script src="resources/shadow-dom.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <p id="description"></p> | 8 <p id="description"></p> |
9 <div id="sandbox"></div> | 9 <div id="sandbox"></div> |
10 <pre id="console"></pre> | 10 <pre id="console"></pre> |
11 <script> | 11 <script> |
12 var sandbox = document.getElementById('sandbox'); | 12 var sandbox = document.getElementById('sandbox'); |
13 | 13 |
14 sandbox.appendChild( | 14 sandbox.appendChild( |
15 createDOM('div', {'id': 'A'}, | 15 createDOM('div', {'id': 'A'}, |
16 createDOM('div', {'id': 'B'}, | 16 createDOM('div', {'id': 'B'}, |
17 createDOM('div', {'id': 'C'})), | 17 createDOM('div', {'id': 'C'})), |
18 createShadowRoot({'id': 'D'}, | 18 createShadowRoot({'id': 'D'}, |
19 createDOM('div', {'id': 'E'}, | 19 createDOM('div', {'id': 'E'}, |
20 createDOM('shadow', {'id': 'X'}, | 20 createDOM('shadow', {'id': 'X'}))), |
21 createDOM('content', {'id': '
F'})))), | |
22 createShadowRoot({'id': 'G'}, | 21 createShadowRoot({'id': 'G'}, |
23 createDOM('div', {'id': 'H'}, | 22 createDOM('div', {'id': 'H'}, |
24 createDOM('shadow', {'id': 'I'}, | 23 createDOM('shadow', {'id': 'I'}))))); |
25 createDOM('content', {'id': '
J'})))))); | |
26 | 24 |
27 ['A', 'B', 'C', 'A/', 'A/E', 'A/F', 'A/X', 'A//', 'A//H', 'A//I', 'A//J'].forEac
h(function(path) { | 25 ['A', 'B', 'C', 'A/', 'A/E', 'A/X', 'A//', 'A//H', 'A//I'].forEach(function(path
) { |
28 getNodeInTreeOfTrees(path).addEventListener('click', function(event) { | 26 getNodeInTreeOfTrees(path).addEventListener('click', function(event) { |
29 debug('\nevent.path on node ' + dumpNode(event.currentTarget)); | 27 debug('\nevent.path on node ' + dumpNode(event.currentTarget)); |
30 debug(dumpNodeList(event.path)); | 28 debug(dumpNodeList(event.path)); |
31 }); | 29 }); |
32 }); | 30 }); |
33 var clickEvent = document.createEvent("MouseEvents"); | 31 var clickEvent = document.createEvent("MouseEvents"); |
34 clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, fa
lse, false, false, 0, null); | 32 clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, fa
lse, false, false, 0, null); |
35 document.getElementById('C').dispatchEvent(clickEvent); | 33 document.getElementById('C').dispatchEvent(clickEvent); |
36 </script> | 34 </script> |
37 </body> | 35 </body> |
38 </html> | 36 </html> |
OLD | NEW |