fix(js): polyfill Node.isConnected for IE

This commit is contained in:
Paul Chavard 2022-05-11 11:46:06 +02:00
parent 771a92a5e2
commit 2e8bc7e1d0

View file

@ -40,3 +40,16 @@ const fragment = document.createDocumentFragment();
if (fragment.children == undefined) {
polyfillChildren(DocumentFragment.prototype);
}
// IE 11 has no isConnected on Node
function polyfillIsConnected(proto) {
Object.defineProperty(proto, 'isConnected', {
get: function () {
return document.documentElement.contains(this);
}
});
}
if (!('isConnected' in Node.prototype)) {
polyfillIsConnected(Node.prototype);
}