• 0

internet explorer remove element from dom

To use the functionality of childNode.remove() API on internet explorer, you have to use the following polyfill:


( arr => { arr.forEach( item => { item.remove = item.remove || () => { this.parentNode.removeChild(this) } }) }) ( [Element.prototype, CharacterData.prototype, DocumentType.prototype] )

Reference:

  • https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md