Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #453 from azakus/fix-efp
Browse files Browse the repository at this point in the history
Scope elementFromPoint to the current TreeScope
  • Loading branch information
dfreedm committed Jun 6, 2014
2 parents 565320e + 92cd922 commit 6c4490e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/wrappers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,15 @@
if (!element)
return null;
var path = getEventPath(element, null);

// scope the path to this TreeScope
var idx = path.lastIndexOf(self);
if (idx == -1)
return null;
else
path = path.slice(0, idx);

// TODO(dfreedm): pass idx to eventRetargetting to avoid array copy
return eventRetargetting(path, self);
}

Expand Down
4 changes: 4 additions & 0 deletions test/js/ShadowRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ suite('ShadowRoot', function() {
'background: green';

assert.equal(sr.elementFromPoint(5, 5), a);

var sr2 = a.createShadowRoot();
assert.equal(sr.elementFromPoint(5, 5), a);
assert.equal(sr2.elementFromPoint(5, 5), null);
});

test('getElementById', function() {
Expand Down

0 comments on commit 6c4490e

Please sign in to comment.