Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/event-deeppath-closed-shadowroot2.html

Issue 2051743002: Rename deep-path to composed-path in LayoutTests/shadow-dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean-tests-2
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <script src="../resources/js-test.js"></script>
3 <script src="../fast/dom/shadow/resources/shadow-dom.js"></script>
4 <body></body>
5 <script>
6 function prepareTree() {
7 // Note: #target will be distributed to furthest <content>.
8 document.body.appendChild(
9 createDOM('div', {id: 'host_closed'},
10 attachShadow({mode: 'closed'},
11 createDOM('div', {id: 'div1_open'},
12 createDOM('content', {id: 'c1'}),
13 attachShadow({mode: 'open'},
14 createDOM('content', {id: 'c2'})))),
15 createDOM('div', {id: 'host_open'},
16 attachShadow({mode: 'open'},
17 createDOM('div', {id: 'div2_closed'},
18 attachShadow({mode: 'closed'},
19 createDOM('div', {id: 'div3_open'},
20 attachShadow({mode: 'open'},
21 createDOM('div', {id: 'target'})))))))));
22 }
23
24 debug('Event.composedPath() should include only unclosed nodes.');
25
26 prepareTree();
27
28 var target = getNodeInComposedTree('host_open/div2_closed/div3_open/target');
29
30 debug('The full event path should be (length=12):\n' +
31 'div#target, #shadow-root (open), div#div3_open, #shadow-root (closed),\n' +
32 'div#div2_closed, #shadow-root (open), div#host_open, div#host_closed,\n' +
33 'body, html, #document, window\n');
34
35 debug('On #host_closed, #host_open, and #div2_closed,\n' +
36 'div#target, #shadow-root (open), div#div3_open, #shadow-root (closed)\n' +
37 'will be trimmed (length=8).\n');
38
39 ['host_closed', 'host_open', 'host_open/div2_closed', 'host_open/div2_closed/div 3_open', 'host_open/div2_closed/div3_open/target'].forEach(function(nodePath) {
40 var node = getNodeInComposedTree(nodePath);
41
42 var eventPath;
43 var clickHandler = function(e) { eventPath = e.composedPath(); };
44 node.addEventListener('click', clickHandler, false);
45
46 debug('\nDispaching a click event on #target, listening on #' + node.id + '.') ;
47 eventPath = null;
48 target.click();
49 debug('Got event.composedPath() for #' + node.id + ':');
50 debug(dumpNodeList(eventPath));
51
52 node.removeEventListener('click', clickHandler, false);
53 });
54 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698