Skip to content

Commit

Permalink
Add array support to remove()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannik Zschiesche committed Jul 5, 2017
1 parent 1af2ca1 commit 44b9c57
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dom/manipulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ export function setAttrs (element, attributes)


/**
* Removes the given element
* Removes the given element(s)
*
* @param {HTMLElement} element
* @param {HTMLElement|HTMLElement[]} element
*/
export function remove (element)
{
element.parentNode.removeChild(element);
const list = Array.isArray(element) ? element : [element];

for (let i = 0; i < list.length; i++)
{
list[i].parentNode.removeChild(list[i]);
}
}


Expand Down

0 comments on commit 44b9c57

Please sign in to comment.