Skip to content

Commit

Permalink
improve performance by only applying _dispatched on a bubbling event
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 3, 2023
1 parent 30fa4b4 commit c701524
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/diff/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ function eventProxy(e) {
* when the dom performs an event it leaves micro-ticks in between bubbling up which means that an event can trigger on a newly
* created DOM-node while the event bubbles up, this can cause quirky behavior as seen in https://github.com/preactjs/preact/issues/3927
*/
if (!e._dispatched) {
if (!e._dispatched && e.bubbles) {
e._dispatched = Date.now();
} else if (e._dispatched <= eventHandler._attached) {
} else if (e._dispatched && e._dispatched <= eventHandler._attached) {
return;
}
return eventHandler(options.event ? options.event(e) : e);
Expand Down

0 comments on commit c701524

Please sign in to comment.