Skip to content

Commit

Permalink
Adds an ie11 polyfill for remove()
Browse files Browse the repository at this point in the history
Fixes: OX-10634
  • Loading branch information
mko-sci committed Dec 8, 2023
1 parent 647101c commit 42a7019
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 42a7019

Please sign in to comment.