-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event Target is null after propagation stopped #1529
Labels
bug
Something isn't working
Comments
Thank you for reporting @rothsandro! 🙂 This should now be fixed in v16.5.2 |
@capricorn86 Thanks 🙏 |
DennisRasey
pushed a commit
to DennisRasey/forgejo
that referenced
this issue
Feb 1, 2025
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [happy-dom](https://github.com/capricorn86/happy-dom) | devDependencies | minor | [`16.3.0` -> `16.8.1`](https://renovatebot.com/diffs/npm/happy-dom/16.3.0/16.8.1) | --- ### Release Notes <details> <summary>capricorn86/happy-dom (happy-dom)</summary> ### [`v16.8.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.8.1) [Compare Source](capricorn86/happy-dom@v16.8.0...v16.8.1) ##### 👷♂️ Patch fixes - Handle non-string values gracefully when removing an attribute - By **[@​OlaviSau](https://github.com/OlaviSau)** in task [#​1706](capricorn86/happy-dom#1706) ### [`v16.8.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.8.0) [Compare Source](capricorn86/happy-dom@v16.7.3...v16.8.0) ##### 🎨 Features - Add support for `insertRow()` and `deleteRow()` to `HTMLTableSectionElement` - By **[@​christiango](https://github.com/christiango)** in task [#​1708](capricorn86/happy-dom#1708) ### [`v16.7.3`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.3) [Compare Source](capricorn86/happy-dom@v16.7.2...v16.7.3) ##### 👷♂️ Patch fixes - Removes space from directory name that prevents the repo to be cloned on MS Windows - By **[@​kleinfreund](https://github.com/kleinfreund)** in task [#​1703](capricorn86/happy-dom#1703) ### [`v16.7.2`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.2) [Compare Source](capricorn86/happy-dom@v16.7.1...v16.7.2) ##### 👷♂️ Patch fixes - Ignore invalid cookies in CookieContainer - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1693](capricorn86/happy-dom#1693) ### [`v16.7.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.1) [Compare Source](capricorn86/happy-dom@v16.7.0...v16.7.1) ##### 👷♂️ Patch fixes - Adds `ICookie`, `IOptionalCookie`, `CookieSameSiteEnum` and `IVirtualServer` as exports to the index file - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1693](capricorn86/happy-dom#1693) - Makes non-mandatory cookie properties optional in `CookieContainer.addCookies()` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1693](capricorn86/happy-dom#1693) ### [`v16.7.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.0) [Compare Source](capricorn86/happy-dom@v16.6.0...v16.7.0) ##### 🎨 Features - Adds support for simulating local HTTP servers that serves files from the local file system - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1688](capricorn86/happy-dom#1688) - Read more about virtual servers in the [Wiki](https://github.com/capricorn86/happy-dom/wiki/IVirtualServer) ### [`v16.6.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.6.0) [Compare Source](capricorn86/happy-dom@v16.5.3...v16.6.0) ##### 🎨 Features - Adds support for subsequent sibling combinator to `querySelector()`, `querySelectorAll()` and `matches()` (e.g. ".a ~ .b") - By **[@​karpiuMG](https://github.com/karpiuMG)** in task [#​1683](capricorn86/happy-dom#1683) ### [`v16.5.3`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.3) [Compare Source](capricorn86/happy-dom@v16.5.2...v16.5.3) ##### 👷♂️ Patch fixes - Fixes problem with encoding and decoding attribute values in HTML - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1678](capricorn86/happy-dom#1678) - Fixes issue where it was not possible to query selector by class when the attribute value had line breaks in it - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1678](capricorn86/happy-dom#1678) ### [`v16.5.2`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.2) [Compare Source](capricorn86/happy-dom@v16.5.1...v16.5.2) ##### 👷♂️ Patch fixes - `Event.target` should be the target element after an event has been dispatched - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1529](capricorn86/happy-dom#1529) ### [`v16.5.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.1) [Compare Source](capricorn86/happy-dom@v16.5.0...v16.5.1) ##### 👷♂️ Patch fixes - Fixes issue where `Comment`, `Text` and `DocumentFragment` are not instances of their corresponding property on `Window` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1577](capricorn86/happy-dom#1577) ### [`v16.5.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.0) [Compare Source](capricorn86/happy-dom@v16.4.3...v16.5.0) ##### 🎨 Features - Adds property `GlobalRegistrator.isRegistered` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1670](capricorn86/happy-dom#1670) ### [`v16.4.3`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.3) [Compare Source](capricorn86/happy-dom@v16.4.2...v16.4.3) ##### 👷♂️ Patch fixes - Adds null check for if browser frame is available in `Response` during tear down of the `Window` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1669](capricorn86/happy-dom#1669) ### [`v16.4.2`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.2) [Compare Source](capricorn86/happy-dom@v16.4.1...v16.4.2) ##### 👷♂️ Patch fixes - Support using URL as an object for URL:s when using the Browser API - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1664](capricorn86/happy-dom#1664) ### [`v16.4.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.1) [Compare Source](capricorn86/happy-dom@v16.4.0...v16.4.1) ##### 👷♂️ Patch fixes - Fixes issue where HTML assigned to `document.documentElement.innerHTML` isnt parsed correctly since v16 - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1663](capricorn86/happy-dom#1663) ### [`v16.4.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.0) [Compare Source](capricorn86/happy-dom@v16.3.0...v16.4.0) ##### 🎨 Features - Allow fetch to be intercepted and modified by sending in an interceptor as a setting - By **[@​OlaviSau](https://github.com/OlaviSau)** in task [#​1502](capricorn86/happy-dom#1502) - Read more about this in the Wiki at [IFetchInterceptor](https://github.com/capricorn86/happy-dom/wiki/IFetchInterceptor) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "* 0-3 1 * *" (UTC), Automerge - "* 0-3 * * *" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMzYuMSIsInVwZGF0ZWRJblZlciI6IjM5LjEzNi4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiLCJ0ZXN0L25vdC1uZWVkZWQiXX0=--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6757 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
humaton
pushed a commit
to fedora-infra/forgejo-deployment-images
that referenced
this issue
Feb 18, 2025
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [happy-dom](https://github.com/capricorn86/happy-dom) | devDependencies | minor | [`16.3.0` -> `16.8.1`](https://renovatebot.com/diffs/npm/happy-dom/16.3.0/16.8.1) | --- ### Release Notes <details> <summary>capricorn86/happy-dom (happy-dom)</summary> ### [`v16.8.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.8.1) [Compare Source](capricorn86/happy-dom@v16.8.0...v16.8.1) ##### 👷♂️ Patch fixes - Handle non-string values gracefully when removing an attribute - By **[@​OlaviSau](https://github.com/OlaviSau)** in task [#​1706](capricorn86/happy-dom#1706) ### [`v16.8.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.8.0) [Compare Source](capricorn86/happy-dom@v16.7.3...v16.8.0) ##### 🎨 Features - Add support for `insertRow()` and `deleteRow()` to `HTMLTableSectionElement` - By **[@​christiango](https://github.com/christiango)** in task [#​1708](capricorn86/happy-dom#1708) ### [`v16.7.3`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.3) [Compare Source](capricorn86/happy-dom@v16.7.2...v16.7.3) ##### 👷♂️ Patch fixes - Removes space from directory name that prevents the repo to be cloned on MS Windows - By **[@​kleinfreund](https://github.com/kleinfreund)** in task [#​1703](capricorn86/happy-dom#1703) ### [`v16.7.2`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.2) [Compare Source](capricorn86/happy-dom@v16.7.1...v16.7.2) ##### 👷♂️ Patch fixes - Ignore invalid cookies in CookieContainer - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1693](capricorn86/happy-dom#1693) ### [`v16.7.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.1) [Compare Source](capricorn86/happy-dom@v16.7.0...v16.7.1) ##### 👷♂️ Patch fixes - Adds `ICookie`, `IOptionalCookie`, `CookieSameSiteEnum` and `IVirtualServer` as exports to the index file - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1693](capricorn86/happy-dom#1693) - Makes non-mandatory cookie properties optional in `CookieContainer.addCookies()` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1693](capricorn86/happy-dom#1693) ### [`v16.7.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.7.0) [Compare Source](capricorn86/happy-dom@v16.6.0...v16.7.0) ##### 🎨 Features - Adds support for simulating local HTTP servers that serves files from the local file system - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1688](capricorn86/happy-dom#1688) - Read more about virtual servers in the [Wiki](https://github.com/capricorn86/happy-dom/wiki/IVirtualServer) ### [`v16.6.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.6.0) [Compare Source](capricorn86/happy-dom@v16.5.3...v16.6.0) ##### 🎨 Features - Adds support for subsequent sibling combinator to `querySelector()`, `querySelectorAll()` and `matches()` (e.g. ".a ~ .b") - By **[@​karpiuMG](https://github.com/karpiuMG)** in task [#​1683](capricorn86/happy-dom#1683) ### [`v16.5.3`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.3) [Compare Source](capricorn86/happy-dom@v16.5.2...v16.5.3) ##### 👷♂️ Patch fixes - Fixes problem with encoding and decoding attribute values in HTML - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1678](capricorn86/happy-dom#1678) - Fixes issue where it was not possible to query selector by class when the attribute value had line breaks in it - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1678](capricorn86/happy-dom#1678) ### [`v16.5.2`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.2) [Compare Source](capricorn86/happy-dom@v16.5.1...v16.5.2) ##### 👷♂️ Patch fixes - `Event.target` should be the target element after an event has been dispatched - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1529](capricorn86/happy-dom#1529) ### [`v16.5.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.1) [Compare Source](capricorn86/happy-dom@v16.5.0...v16.5.1) ##### 👷♂️ Patch fixes - Fixes issue where `Comment`, `Text` and `DocumentFragment` are not instances of their corresponding property on `Window` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1577](capricorn86/happy-dom#1577) ### [`v16.5.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.5.0) [Compare Source](capricorn86/happy-dom@v16.4.3...v16.5.0) ##### 🎨 Features - Adds property `GlobalRegistrator.isRegistered` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1670](capricorn86/happy-dom#1670) ### [`v16.4.3`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.3) [Compare Source](capricorn86/happy-dom@v16.4.2...v16.4.3) ##### 👷♂️ Patch fixes - Adds null check for if browser frame is available in `Response` during tear down of the `Window` - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1669](capricorn86/happy-dom#1669) ### [`v16.4.2`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.2) [Compare Source](capricorn86/happy-dom@v16.4.1...v16.4.2) ##### 👷♂️ Patch fixes - Support using URL as an object for URL:s when using the Browser API - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1664](capricorn86/happy-dom#1664) ### [`v16.4.1`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.1) [Compare Source](capricorn86/happy-dom@v16.4.0...v16.4.1) ##### 👷♂️ Patch fixes - Fixes issue where HTML assigned to `document.documentElement.innerHTML` isnt parsed correctly since v16 - By **[@​capricorn86](https://github.com/capricorn86)** in task [#​1663](capricorn86/happy-dom#1663) ### [`v16.4.0`](https://github.com/capricorn86/happy-dom/releases/tag/v16.4.0) [Compare Source](capricorn86/happy-dom@v16.3.0...v16.4.0) ##### 🎨 Features - Allow fetch to be intercepted and modified by sending in an interceptor as a setting - By **[@​OlaviSau](https://github.com/OlaviSau)** in task [#​1502](capricorn86/happy-dom#1502) - Read more about this in the Wiki at [IFetchInterceptor](https://github.com/capricorn86/happy-dom/wiki/IFetchInterceptor) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "* 0-3 1 * *" (UTC), Automerge - "* 0-3 * * *" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMzYuMSIsInVwZGF0ZWRJblZlciI6IjM5LjEzNi4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiLCJ0ZXN0L25vdC1uZWVkZWQiXX0=--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6757 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: