Skip to content

Commit

Permalink
fix(jqLite): ensure mouseenter works with svg elements on IE
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuzminov Aleksandr Sergeevich authored and petebacondarwin committed Oct 26, 2015
1 parent d0237df commit 8cc730d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ function jqLiteParseHTML(html, context) {
return [];
}


// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
var jqLiteContains = Node.prototype.contains || function(arg) {
// jshint bitwise: false
return !!(this.compareDocumentPosition(arg) & 16);
// jshint bitwise: true
};

/////////////////////////////////////////////
function JQLite(element) {
if (element instanceof JQLite) {
Expand Down Expand Up @@ -826,7 +834,7 @@ forEach({
var target = this, related = event.relatedTarget;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if (!related || (related !== target && !target.contains(related))) {
if (!related || (related !== target && !jqLiteContains.call(target, related))) {
handle(event, type);
}
});
Expand Down

0 comments on commit 8cc730d

Please sign in to comment.