access-nyc-patterns
Version:
User Interface Patterns for Benefits Access
28 lines (24 loc) • 606 B
JavaScript
;
/**
* Polyfill for Element.prototype.remove()
* https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#Polyfill
*/
(function(arr) {
arr.forEach(function(item) {
if (item.hasOwnProperty('remove')) return;
Object.defineProperty(item, 'remove', {
configurable: true,
enumerable: true,
writable: true,
value: function remove() {
if (this.parentNode !== null)
this.parentNode.removeChild(this);
}
});
});
})([
Element.prototype,
CharacterData.prototype,
DocumentType.prototype
]);
/* eslint-enable no-undef */