Skip to content

Commit 74709b0

Browse files
authored
Apply context when dispatching event
`this` inside of event listeners should be the element that the listener was registered on. Without this, dispatching events on preact elements was failing with `Cannot read property 'click' of undefined`
1 parent cb65458 commit 74709b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/undom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default function undom() {
134134
do {
135135
l = t.__handlers[toLower(event.type)];
136136
if (l) for (i=l.length; i--; ) {
137-
if ((l[i](event)===false || event._end) && c) break;
137+
if ((l[i].call(t, event)===false || event._end) && c) break;
138138
}
139139
} while (event.bubbles && !(c && event._stop) && (event.target=t=t.parentNode));
140140
return !event.defaultPrevented;

0 commit comments

Comments
 (0)