Skip to content

Commit

Permalink
Merge pull request #1343 from scireum/feature/mko/OX-10634
Browse files Browse the repository at this point in the history
Adds an ie11 polyfill for remove()
  • Loading branch information
mko-sci authored Dec 8, 2023
2 parents 647101c + 42a7019 commit 38bb091
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ ___include("/assets/common/libs/es6-promise/es6-promise.min.js")
___include("/assets/common/libs/fetch/fetch.umd.js")
___include("/assets/common/libs/url-search-params/url-search-params.js")
___include("/assets/common/libs/formdata/formdata.min.js")
___include("/assets/common/libs/remove/remove.js")
14 changes: 14 additions & 0 deletions src/main/resources/default/assets/common/libs/remove/remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* 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']);

0 comments on commit 38bb091

Please sign in to comment.