Skip to content

Commit 790b5bf

Browse files
committed
feat: use data-targets for @targets
Fixes #34
1 parent d2dc99f commit 790b5bf

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/findtarget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function findTarget(controller: HTMLElement, name: string): Element | und
2020
export function findTargets(controller: HTMLElement, name: string): Element[] {
2121
const tag = controller.tagName.toLowerCase()
2222
const targets = []
23-
for (const el of controller.querySelectorAll(`[data-target~="${tag}.${name}"]`)) {
23+
for (const el of controller.querySelectorAll(`[data-targets~="${tag}.${name}"]`)) {
2424
if (el.closest(tag) === controller) targets.push(el)
2525
}
2626
return targets

test/findtarget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('findTargets', () => {
8787
chai.spy.on(instance, 'querySelectorAll', () => [])
8888
findTargets(instance, 'foo')
8989
expect(instance.querySelectorAll).to.have.been.called.once.with.exactly(
90-
'[data-target~="find-target-test-element.foo"]'
90+
'[data-targets~="find-target-test-element.foo"]'
9191
)
9292
})
9393

0 commit comments

Comments
 (0)