From 2695aa7da49ffa287ebf03e56364738dfc65d7bf Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Thu, 29 May 2014 19:18:58 -0400 Subject: [PATCH] Event path should return every nodes in the event path --- src/wrappers/events.js | 22 ++++------------------ test/js/events.js | 9 +++++++++ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/wrappers/events.js b/src/wrappers/events.js index c383c1d..72dfc7a 100644 --- a/src/wrappers/events.js +++ b/src/wrappers/events.js @@ -475,25 +475,11 @@ return eventPhaseTable.get(this); }, get path() { - var nodeList = new wrappers.NodeList(); var eventPath = eventPathTable.get(this); - if (eventPath) { - var index = 0; - var lastIndex = eventPath.length - 1; - var baseRoot = getTreeScope(currentTargetTable.get(this)); - - for (var i = 0; i <= lastIndex; i++) { - var currentTarget = eventPath[i]; - var currentRoot = getTreeScope(currentTarget); - if (currentRoot.contains(baseRoot) && - // Make sure we do not add Window to the path. - (i !== lastIndex || currentTarget instanceof wrappers.Node)) { - nodeList[index++] = currentTarget; - } - } - nodeList.length = index; - } - return nodeList; + if (!eventPath) + return []; + // TODO(arv): Event path should contain window. + return eventPath.slice(); }, stopPropagation: function() { stopPropagationTable.set(this, true); diff --git a/test/js/events.js b/test/js/events.js index 96ea8df..2e22645 100644 --- a/test/js/events.js +++ b/test/js/events.js @@ -1194,6 +1194,9 @@ test('retarget order (multiple shadow roots)', function() { [ tree.c, tree.content, + tree.content2, + tree.e, + tree.sr2, tree.d, tree.sr, tree.b, @@ -1209,6 +1212,12 @@ test('retarget order (multiple shadow roots)', function() { assertArrayEqual( [ tree.c, + tree.content, + tree.content2, + tree.e, + tree.sr2, + tree.d, + tree.sr, tree.b, tree.a, tree.div,