Fix #4963 - SVG <use> swallows click events

This commit is contained in:
David Ed Mellum
2015-12-18 17:10:58 +01:00
parent 4865ddf7ea
commit 2fdaba49c7
@@ -20,6 +20,12 @@
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Normalize SVG <use> element events #4963
if (target.correspondingUseElement) {
target = target.correspondingUseElement;
}
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;