Support capture events
josh opened this issue · 0 comments
josh commented
Feature request!
Would ❤️ support for capture events.
on('submit', 'form.js-validate-submission', (event) => {
// ...
}, {capture: true})
or maybe we're getting kinda long on arguments, support named arguments for the full API:
on({
event: 'submit',
selector: 'form.js-validate-submission',
capture: true
}, (event) => {
// ...
})
Capture events would run before directly bound event handlers.
on('submit', 'form', (event) => {
console.log(1)
}, {capture: true})
observe('form', (form) => {
form.addEventListener('submit', (event) => {
console.log(2)
})
})
on('submit', 'form', (event) => {
console.log(3)
})
Maybe I'll have time to write up a PR, but figured I'd make an issue first.