You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Happy DOM v15.1.0 changed how events are handled. If the propagation of an event is stopped, the event target is set to null. However, this is different from the browser behavior and breaks use cases when calling event.stopPropagation() but still keeping a reference to the event and using it later.
This is done in EventTarget.ts (also for target + none phase):
Expected behavior
The event should have the button as target, even if the event propagation is stopped. event target: button should be logged in the console, but the target is null.
If you run the same code in the browser DevTools everything works fine, the target is still available.
Device:
OS: Windows 11
Browser Chrome v128
Additional context
We use a third-party component library and their tags component is broken with happy-dom 15.1.0 and above because of that new behavior. I don't know in detail what they are doing, but they somehow listen to the click event when selecting an item, dispatch a internal dxclick event and use the original event's target to get the selected item and its data. Because the event target is not available anymore, this breaks the selection.
The text was updated successfully, but these errors were encountered:
Describe the bug
Happy DOM v15.1.0 changed how events are handled. If the propagation of an event is stopped, the event target is set to
null
. However, this is different from the browser behavior and breaks use cases when callingevent.stopPropagation()
but still keeping a reference to the event and using it later.This is done in
EventTarget.ts
(also for target + none phase):To Reproduce
Steps to reproduce the behavior:
node index.js
in the terminalExpected behavior
The event should have the button as target, even if the event propagation is stopped.
event target: button
should be logged in the console, but the target isnull
.If you run the same code in the browser DevTools everything works fine, the target is still available.
Device:
Additional context
We use a third-party component library and their tags component is broken with happy-dom 15.1.0 and above because of that new behavior. I don't know in detail what they are doing, but they somehow listen to the click event when selecting an item, dispatch a internal
dxclick
event and use the original event's target to get the selected item and its data. Because the event target is not available anymore, this breaks the selection.The text was updated successfully, but these errors were encountered: