[refactor] Moved 'removeElement' to its own TS file; deduped logic

This commit is contained in:
Steven Evans
2018-07-07 23:42:58 -04:00
parent 3a20809943
commit 95939a8818
6 changed files with 47 additions and 33 deletions
+1 -8
View File
@@ -1,12 +1,6 @@
//General helper functions
import {isString} from "./helpers/isString";
function removeElement(elem) {
if (elem == null || !(elem instanceof Element)) {return;}
while(elem.firstChild) {elem.removeChild(elem.firstChild);}
elem.parentNode.removeChild(elem);
}
function removeChildrenFromElement(el) {
if (isString(el)) {
el = document.getElementById(el);
@@ -54,7 +48,6 @@ function clearSelector(selector) {
}
}
export {removeElement,
createAccordionElement,
export {createAccordionElement,
removeChildrenFromElement,
clearSelector};