Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
1cg committed Apr 17, 2024
1 parent 01cb5e0 commit 2be7054
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -2603,28 +2603,27 @@ var htmx = (function() {
* @returns {Element[]}
*/
const HX_ON_QUERY = new XPathEvaluator()
.createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or' +
' starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');
.createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or' +
' starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]')

function processHXOnRoot(elt, elements) {
if (shouldProcessHxOn(elt)) {
elements.push(asElement(elt))
}
const iter = HX_ON_QUERY.evaluate(elt)
let node = null;
let node = null
while (node = iter.iterateNext()) elements.push(asElement(node))
}

function findHxOnWildcardElements(elt) {
let node = null
/** @type {Element[]} */
const elements = []
if (elt instanceof DocumentFragment) {
for (const child of elt.childNodes) {
processHXOnRoot(child, elements);
processHXOnRoot(child, elements)
}
} else {
processHXOnRoot(elt, elements);
processHXOnRoot(elt, elements)
}
return elements
}
Expand Down
3 changes: 1 addition & 2 deletions test/core/shadowdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,10 +1308,9 @@ describe('Core htmx Shadow DOM Tests', function() {

it('can handle basic events w/ no other attributes in child', function() {
var div = make("<div><button id='b1' hx-on:click='window.foo = true'>Foo</button></div>")
var btn = div.querySelector("#b1")
var btn = div.querySelector('#b1')
btn.click()
window.foo.should.equal(true)
delete window.foo
})

})

0 comments on commit 2be7054

Please sign in to comment.