-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Description
Description
When using the delegated version of $parent.on(events, selector, handler) with events being a MouseEvent, the event is not recognized in IE11 and Edge (and possibly in other IE flavors either), if the .target of the event is an SVG <use> element pointing to an externally defined symbol.
<svg><defs><rect id="sym"...></defs></svg>
<p><use xlink:href="#sym"/></svg></p>
$(document).on('click', 'p', handler); // This will not work
The event is recognized if the reference SVG symbol (pointed by the <use>'s xlink:href attribute) is itself declared inside the delegation target pointed by selector, e.g in above example if the first <svg> element were in the targeted <p>, it would work.
It will also work if the event is not delegated, e.g with the first HTML structure, $('p').on('click', handler) will work.
I believe this is because IE does set the target of such event to a weird SVGElementInstance, probably representing the shadow-element <use> element uses.
I don't know IE that much and it's the first time I encounter this weird object, which I don't think is part of any standards, but I thought you might want to handle this case.