mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-06 17:44:33 +00:00
Add html element remove polyfill
This commit is contained in:
parent
de2098f0cf
commit
781273e91d
@ -83,10 +83,30 @@ function objectPolyfills() {
|
||||
}
|
||||
}
|
||||
|
||||
function domPolyfills() {
|
||||
// from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md
|
||||
(function (arr) {
|
||||
arr.forEach(function (item) {
|
||||
if (item.hasOwnProperty("remove")) {
|
||||
return;
|
||||
}
|
||||
Object.defineProperty(item, "remove", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function remove() {
|
||||
this.parentNode.removeChild(this);
|
||||
},
|
||||
});
|
||||
});
|
||||
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
|
||||
}
|
||||
|
||||
function initPolyfills() {
|
||||
mathPolyfills();
|
||||
stringPolyfills();
|
||||
objectPolyfills();
|
||||
domPolyfills();
|
||||
}
|
||||
|
||||
function initExtensions() {
|
||||
|
Loading…
Reference in New Issue
Block a user