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

Commit

Permalink
Fix issue with elementFromPoint when null
Browse files Browse the repository at this point in the history
Fixes #434
  • Loading branch information
arv committed May 14, 2014
1 parent b760852 commit d67c3b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/wrappers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,8 @@
scope.renderAllPending();

var element = wrap(originalElementFromPoint.call(document.impl, x, y));
if (!element)
return null;
var path = getEventPath(element, null);
return eventRetargetting(path, self);
}
Expand Down
7 changes: 7 additions & 0 deletions test/js/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ htmlSuite('Document', function() {
assert.equal(doc.elementFromPoint(5, 5), div);
});

test('elementFromPoint null', function() {
assert.isNull(document.elementFromPoint(-9999, -9999));

var doc = wrap(document);
assert.isNull(doc.elementFromPoint(-9999, -9999));
});

test('document.contains', function() {
assert.isTrue(document.contains(document.body));
assert.isTrue(document.contains(document.querySelector('body')));
Expand Down

0 comments on commit d67c3b1

Please sign in to comment.