mirror of
https://gitlab.com/octtspacc/Friendiiverse
synced 2024-12-22 13:25:55 +01:00
15 lines
439 B
JavaScript
15 lines
439 B
JavaScript
/**
|
|
* ChildNode.remove() polyfill
|
|
* https://gomakethings.com/removing-an-element-from-the-dom-the-es6-way/
|
|
* @author Chris Ferdinandi
|
|
* @license MIT
|
|
*/
|
|
(function (elem) {
|
|
for (var i = 0; i < elem.length; i++) {
|
|
if (!window[elem[i]] || 'remove' in window[elem[i]].prototype) continue;
|
|
window[elem[i]].prototype.remove = function () {
|
|
this.parentNode.removeChild(this);
|
|
};
|
|
}
|
|
})(['Element', 'CharacterData', 'DocumentType']);
|