From 8cc730d52112cc210b1d4ca71a595a78f81e313e Mon Sep 17 00:00:00 2001 From: Kuzminov Aleksandr Sergeevich Date: Tue, 2 Dec 2014 12:17:46 +0300 Subject: [PATCH] fix(jqLite): ensure mouseenter works with svg elements on IE Closes #10259 Closes #10276 --- src/jqLite.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/jqLite.js b/src/jqLite.js index c899ac186ee4..80680ac55469 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -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) { @@ -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); } });