Skip to content

Commit

Permalink
use only one query to retrieve elements
Browse files Browse the repository at this point in the history
  • Loading branch information
mihalikv committed Dec 3, 2023
1 parent e422aec commit f95bc07
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1894,10 +1894,6 @@ return (function () {
});
}

function getBoostedWrappers() {
return document.querySelector("[hx-boost], [data-hx-boost]");
}

function shouldProcessHxOn(elt) {
var attributes = elt.attributes
for (var j = 0; j < attributes.length; j++) {
Expand Down Expand Up @@ -1934,10 +1930,10 @@ return (function () {

function findElementsToProcess(elt) {
if (elt.querySelectorAll) {
var boostedElts = document.querySelectorAll("[hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]");
var results = elt.querySelectorAll(VERB_SELECTOR + ", form, [type='submit'], [hx-sse], [data-hx-sse], [hx-ws]," +
var boostedSelector = ", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]";
var results = elt.querySelectorAll(VERB_SELECTOR + boostedSelector + ", form, [type='submit'], [hx-sse], [data-hx-sse], [hx-ws]," +
" [data-hx-ws], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger], [hx-on], [data-hx-on]");
return toArray(results).concat(toArray(boostedElts));
return results;
} else {
return [];
}
Expand Down

0 comments on commit f95bc07

Please sign in to comment.