Support for handleEvent DOM interface
See original GitHub issueReproduction
class Foo {
click(e) {
this.setState({ clicked: true })
}
handleEvent(e) {
// nicety: `this` is the component
this[e.type](e)
}
render() {
return <button onClick={this} />
}
}
Steps to reproduce
Click the button.
Expected Behavior
handleEvent is used and doesn’t throw an error.
Actual Behavior
this.l[e.type](P.event ? P.event(e) : e)
throws an error, as this.l[e.type]
is this
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
DOM handleEvent: a cross-platform standard since year 2000
The handleEvent ABC is that any object that implements such method will be invoked as obj.handleEvent(event) once the event happens. The method can...
Read more >EventTarget.addEventListener() - Web APIs | MDN
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered ...
Read more >1. Document Object Model Events
The User Interface event module is composed of events listed in HTML 4.0 and additional events which are supported in DOM Level 0...
Read more >Support handleEvent / DOM method names · Issue #31 - GitHub
Support handleEvent / DOM method names #31. Open. bcomnes opened this issue on May 12, ... for some reasons why this is an...
Read more >EventListener (Java Platform SE 7 ) - Oracle Help Center
The EventListener interface is the primary method for handling events. Users implement the EventListener interface and register their listener on an ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s interesting! First time I’ve heard of it. If you can’t wait, you can patch that into Preact via an option hook:
Definitely! I can throw a PR together that should at least show the rough outline of what we are proposing here, then we can go from there?