@schukai/monster 3.68.3 → 3.68.4

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.68.4] - 2024-06-23
6
+
7
+ ### Bug Fixes
8
+
9
+ - if the query is empty but astring, getSlottedElements must not report an error [#208](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/208)
10
+
11
+
12
+
5
13
  ## [3.68.3] - 2024-06-23
6
14
 
7
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.5","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.68.3"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.5","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.68.4"}
@@ -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
  }