Skip to content

Commit 8b7a90a

Browse files
author
Philip Roberts
committed
Bind a controller to itself
1 parent 819ca9c commit 8b7a90a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

catalyst/src/bind.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export function bind(controller: HTMLElement) {
1212
bindActionsToController(controller, el)
1313
}
1414

15+
// Also bind the controller to itself
16+
if (controller.matches(actionAttributeMatcher)) {
17+
bindActionsToController(controller, controller)
18+
}
19+
}
20+
1521
// Bind the data-action attribute of a single element to the controller
1622
function bindActionsToController(controller: HTMLElement, el: Element) {
1723
const tag = controller.tagName.toLowerCase()

0 commit comments

Comments
 (0)