fixup 0de69e30: avoid passing falsy selectors to $()

This commit is contained in:
tophf 2017-12-02 21:41:28 +03:00
parent 0de69e306d
commit 6704956b22

View File

@ -12,7 +12,7 @@ for (const type of [NodeList, NamedNodeMap, HTMLCollection, HTMLAllCollection])
} }
$.remove = (selector, base = document) => { $.remove = (selector, base = document) => {
const el = selector instanceof Node ? selector : $(selector, base); const el = selector && typeof selector === 'string' ? $(selector, base) : selector;
if (el) { if (el) {
el.remove(); el.remove();
} }