@schukai/monster 3.68.3 → 3.69.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -103,15 +103,19 @@ function getSlottedElements(query, name) {
103
103
  if (!(node instanceof HTMLElement)) return;
104
104
 
105
105
  if (isString(query)) {
106
- node.querySelectorAll(query).forEach(function (n) {
107
- result.add(n);
108
- });
109
-
110
- if (node.matches(query)) {
106
+ if (query.length > 0) {
107
+ node.querySelectorAll(query).forEach(function (n) {
108
+ result.add(n);
109
+ });
110
+
111
+ if (node.matches(query)) {
112
+ result.add(node);
113
+ }
114
+ } else {
111
115
  result.add(node);
112
116
  }
113
117
  } else if (query !== undefined) {
114
- throw new Error("query must be a string");
118
+ throw new Error("query must be a string and not empty");
115
119
  } else {
116
120
  result.add(node);
117
121
  }