Skip to content

catching custom events with hypens in the event name eg event-name #4236

Answered by tbroyer
Jero9999 asked this question in Q&A
Discussion options

You must be logged in to vote

This is supposed to work with @my-event=${myEventHandler}, there are a few tests in Lit that use kebab-case like that, e.g.

test('event listeners can see events fired by dynamic children', () => {
// This tests that node directives are called in the commit phase, not
// the setValue phase
class TestElement1 extends HTMLElement {
connectedCallback() {
this.dispatchEvent(
new CustomEvent('test-event', {
bubbles: true,
})
);
}
}
customElements.define('test-element-1', TestElement1);
let event: Event | undefined = undefined;
const l…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by e111077
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants