Skip to content

Commit 9a9d7be

Browse files
committed
Keep global as a first-position-only keyword
1 parent 0da28ca commit 9a9d7be

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/htmx.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,10 @@ var htmx = (function() {
11281128
* @returns {(Node|Window)[]}
11291129
*/
11301130
function querySelectorAllExt(elt, selector, global) {
1131+
if (selector.indexOf('global ') === 0) {
1132+
return querySelectorAllExt(elt, selector.slice(7), true)
1133+
}
1134+
11311135
elt = resolveTarget(elt)
11321136

11331137
const parts = selector.split(',')
@@ -1158,12 +1162,6 @@ var htmx = (function() {
11581162
item = getRootNode(elt, !!global)
11591163
} else if (selector === 'host') {
11601164
item = (/** @type ShadowRoot */(elt.getRootNode())).host
1161-
} else if (selector.indexOf('global ') === 0) {
1162-
// Previous implementation of `global` only supported it at the first position and applied it to the entire selector string.
1163-
// For backward compatibility and to maintain logical consistency, we make it apply to everything that follows.
1164-
parts.unshift(selector.slice(7))
1165-
result.push(...querySelectorAllExt(elt, parts.join(','), true))
1166-
break
11671165
} else {
11681166
unprocessedParts.push(selector)
11691167
}

0 commit comments

Comments
 (0)