fix(js): polyfill Node.isConnected for IE
This commit is contained in:
parent
771a92a5e2
commit
2e8bc7e1d0
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue