@adobe/coral-spectrum
Version:
Coral Spectrum is a JavaScript library of Web Components following Spectrum design patterns.
18 lines (17 loc) • 596 B
JavaScript
// Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/
// Source https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove
(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 && this.parentNode.removeChild(this);
}
});
});
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);