Skip to content
Snippets Groups Projects
Verified Commit f89e0343 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: if the query is empty but astring, getSlottedElements must not report an error #208

parent 0b824983
No related branches found
No related tags found
No related merge requests found
......@@ -103,15 +103,19 @@ function getSlottedElements(query, name) {
if (!(node instanceof HTMLElement)) return;
if (isString(query)) {
node.querySelectorAll(query).forEach(function (n) {
result.add(n);
});
if (node.matches(query)) {
if (query.length > 0) {
node.querySelectorAll(query).forEach(function (n) {
result.add(n);
});
if (node.matches(query)) {
result.add(node);
}
} else {
result.add(node);
}
} else if (query !== undefined) {
throw new Error("query must be a string");
throw new Error("query must be a string and not empty");
} else {
result.add(node);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment