Skip to content

Commit 8cc730d

Browse files
Kuzminov Aleksandr Sergeevichpetebacondarwin
Kuzminov Aleksandr Sergeevich
authored andcommitted
fix(jqLite): ensure mouseenter works with svg elements on IE
Closes angular#10259 Closes angular#10276
1 parent d0237df commit 8cc730d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/jqLite.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ function jqLiteParseHTML(html, context) {
241241
return [];
242242
}
243243

244+
245+
// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
246+
var jqLiteContains = Node.prototype.contains || function(arg) {
247+
// jshint bitwise: false
248+
return !!(this.compareDocumentPosition(arg) & 16);
249+
// jshint bitwise: true
250+
};
251+
244252
/////////////////////////////////////////////
245253
function JQLite(element) {
246254
if (element instanceof JQLite) {
@@ -826,7 +834,7 @@ forEach({
826834
var target = this, related = event.relatedTarget;
827835
// For mousenter/leave call the handler if related is outside the target.
828836
// NB: No relatedTarget if the mouse left/entered the browser window
829-
if (!related || (related !== target && !target.contains(related))) {
837+
if (!related || (related !== target && !jqLiteContains.call(target, related))) {
830838
handle(event, type);
831839
}
832840
});

0 commit comments

Comments
 (0)