We are experiencing an error in IE11 when dom.contains is called in metal-dom in events.js, because we are trying to handle events on an SVG element. We are experiencing this error:
When hovering over the ? icon, IE DevTools yields this error:
SCRIPT438: Object doesn't support property or method 'contains'
File: common.js, Line 1, Column 998455
It turns out that IE has limited support of HTML DOM node methods (like Node.contains), as in, it doesn't support searching for an SVG element inside a DOM node. Our use case happens to be causing this function to search inside an SVG element for a path element, which works in Chrome and FF but is invalid in IE11.
dom.contains
: https://github.com/metal/metal.js/blob/master/packages/metal-dom/src/domNamed.js#L211-L225We are experiencing an error in IE11 when
dom.contains
is called inmetal-dom
in events.js, because we are trying to handle events on an SVG element. We are experiencing this error:When hovering over the
?
icon, IE DevTools yields this error:It turns out that IE has limited support of HTML DOM node methods (like Node.contains), as in, it doesn't support searching for an SVG element inside a DOM node. Our use case happens to be causing this function to search inside an SVG element for a path element, which works in Chrome and FF but is invalid in IE11.
@eduardolundgren made a good point about this. According to him, Metal used to have a
dom.contains
method that usedcompareDocumentPosition()
to compare the position binaries in the DOM tree to see if an element is a descendent of another. A solution like this may bring back full support forcontains
in IE11. The solution might be identical to this one: https://github.com/google/closure-library/blob/e656c0807353188f42b67722d56724a5afc13228/closure/goog/dom/dom.js#L1519-L1542@jbalsas