@schukai/monster 3.68.3 → 3.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  }