| 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> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 createDOM('div', {'id': 'divJ', 'style': 'paddin
g-top: 40px'}, | 82 createDOM('div', {'id': 'divJ', 'style': 'paddin
g-top: 40px'}, |
| 83 createDOM('div', {'id': 'shadowK', 'st
yle': 'padding-top: 40px'}, | 83 createDOM('div', {'id': 'shadowK', 'st
yle': 'padding-top: 40px'}, |
| 84 createShadowRoot( | 84 createShadowRoot( |
| 85 createDOM('div', {'id':
'divL', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))))))); | 85 createDOM('div', {'id':
'divL', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))))))); |
| 86 | 86 |
| 87 var ids = ['divA', 'divB', 'divC', | 87 var ids = ['divA', 'divB', 'divC', |
| 88 'shadowD', 'shadowD/divE', 'shadowD/shadowF', 'shadowD/shadowF/sh
adowG', | 88 'shadowD', 'shadowD/divE', 'shadowD/shadowF', 'shadowD/shadowF/sh
adowG', |
| 89 'shadowD/shadowF/shadowG/divH', 'shadowD/shadowF/shadowG/divI', | 89 'shadowD/shadowF/shadowG/divH', 'shadowD/shadowF/shadowG/divI', |
| 90 'shadowD/divJ', 'shadowD/shadowK', 'shadowD/shadowK/divL']; | 90 'shadowD/divJ', 'shadowD/shadowK', 'shadowD/shadowK/divL']; |
| 91 for (var i = 0; i < ids.length; ++i) { | 91 for (var i = 0; i < ids.length; ++i) { |
| 92 var element = getNodeInTreeOfTrees(ids[i]); | 92 var element = getNodeInComposedTree(ids[i]); |
| 93 element.addEventListener('mouseover', recordEvent, false); | 93 element.addEventListener('mouseover', recordEvent, false); |
| 94 element.addEventListener('mouseout', recordEvent, false); | 94 element.addEventListener('mouseout', recordEvent, false); |
| 95 element.addEventListener('focusin', recordEvent, false); | 95 element.addEventListener('focusin', recordEvent, false); |
| 96 element.addEventListener('focusout', recordEvent, false); | 96 element.addEventListener('focusout', recordEvent, false); |
| 97 element.addEventListener('focus', recordEvent, true); // capturing phas
e | 97 element.addEventListener('focus', recordEvent, true); // capturing phas
e |
| 98 element.addEventListener('blur', recordEvent, true); // capturing phase | 98 element.addEventListener('blur', recordEvent, true); // capturing phase |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 function moveMouse(oldElementId, newElementId, message) | 102 function moveMouse(oldElementId, newElementId, message) |
| 103 { | 103 { |
| 104 debug('\n' + message + '\n' + 'Moving mouse from ' + oldElementId + ' to ' +
newElementId); | 104 debug('\n' + message + '\n' + 'Moving mouse from ' + oldElementId + ' to ' +
newElementId); |
| 105 moveMouseOver(getNodeInTreeOfTrees(oldElementId)); | 105 moveMouseOver(getNodeInComposedTree(oldElementId)); |
| 106 clearEventRecords(); | 106 clearEventRecords(); |
| 107 moveMouseOver(getNodeInTreeOfTrees(newElementId)); | 107 moveMouseOver(getNodeInComposedTree(newElementId)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 function moveFocus(oldElementId, newElementId, message) | 110 function moveFocus(oldElementId, newElementId, message) |
| 111 { | 111 { |
| 112 debug('\n' + message + '\n' + 'Moving focus from ' + oldElementId + ' to ' +
newElementId); | 112 debug('\n' + message + '\n' + 'Moving focus from ' + oldElementId + ' to ' +
newElementId); |
| 113 getNodeInTreeOfTrees(oldElementId).focus(); | 113 getNodeInComposedTree(oldElementId).focus(); |
| 114 clearEventRecords(); | 114 clearEventRecords(); |
| 115 getNodeInTreeOfTrees(newElementId).focus(); | 115 getNodeInComposedTree(newElementId).focus(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 function test() | 118 function test() |
| 119 { | 119 { |
| 120 prepareDOMTree(document.getElementById('sandbox')); | 120 prepareDOMTree(document.getElementById('sandbox')); |
| 121 | 121 |
| 122 // Test for mouseover/mouseout events. | 122 // Test for mouseover/mouseout events. |
| 123 moveMouse('divB', 'divC', | 123 moveMouse('divB', 'divC', |
| 124 'Move mouse from a node to its sibling node. All nodes are outside
of shadow boundary.'); | 124 'Move mouse from a node to its sibling node. All nodes are outside
of shadow boundary.'); |
| 125 shouldBe('dispatchedEvent("mouseover")', '["divC(<-divB)(@divC)", "divC(<-di
vB)(@divA)"]'); | 125 shouldBe('dispatchedEvent("mouseover")', '["divC(<-divB)(@divC)", "divC(<-di
vB)(@divA)"]'); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 moveFocus('shadowD/shadowF/shadowG/divH', 'shadowD/shadowK/divL', | 198 moveFocus('shadowD/shadowF/shadowG/divH', 'shadowD/shadowK/divL', |
| 199 'Old focused node and new focused node exist in separated subtrees
, crossing shadow boundaries. Making sure that an event is not dispatched beyond
the lowest common boundary.'); | 199 'Old focused node and new focused node exist in separated subtrees
, crossing shadow boundaries. Making sure that an event is not dispatched beyond
the lowest common boundary.'); |
| 200 shouldBe('dispatchedEvent("focus")', '["shadowK(<-shadowF)(@divJ)(capturing
phase)", "divL(<-shadowF)(@divL)", "shadowK(<-shadowF)(@shadowK)"]'); | 200 shouldBe('dispatchedEvent("focus")', '["shadowK(<-shadowF)(@divJ)(capturing
phase)", "divL(<-shadowF)(@divL)", "shadowK(<-shadowF)(@shadowK)"]'); |
| 201 shouldBe('dispatchedEvent("blur")', '["shadowF(<-shadowK)(@divE)(capturing p
hase)", "divH(<-shadowK)(@divH)", "shadowG(<-shadowK)(@shadowG)", "shadowF(<-sha
dowK)(@shadowF)"]'); | 201 shouldBe('dispatchedEvent("blur")', '["shadowF(<-shadowK)(@divE)(capturing p
hase)", "divH(<-shadowK)(@divH)", "shadowG(<-shadowK)(@shadowG)", "shadowF(<-sha
dowK)(@shadowF)"]'); |
| 202 } | 202 } |
| 203 | 203 |
| 204 test(); | 204 test(); |
| 205 </script> | 205 </script> |
| 206 </body> | 206 </body> |
| 207 </html> | 207 </html> |
| OLD | NEW |