Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Fix #10259 (mouseenter in svg template in IE) #10276

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ forEach({
handle = expandoStore.handle = createEventHandler(element, events);
}

// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
var contains = Node.prototype.contains || function (arg) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment saying this is IE specific

return !!(this.compareDocumentPosition(arg) & 16);
};

// http://jsperf.com/string-indexof-vs-split
var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];
var i = types.length;
Expand All @@ -804,7 +809,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 && !contains.call(target, related))) {
handle(event, type);
}
});
Expand Down