-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: trigger again when window listener already handled #10611
Conversation
🦋 Changeset detectedLatest commit: 7039ae1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// This is the fallback document listener but the event was already handled | ||
// -> ignore, but set handle_at to document so that we're resetting the event | ||
// @ts-ignore | ||
if (at_idx !== -1 && (handler_element === document || handler_element === window)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just occurred to me that we should probably be using the ownerDocument
from the target element because of iframes rather than the global document
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On first look I thought "yeah makes sense", but on second look: The fallback event listener is set to document
, too - should that one be using container_target.ownerDocument
, too? Either way, this sounds like something we can talk about separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
fixes #10271
the window case was not handle when query listener had handled.
why test ok in before pr #10307?
because window in event.composedPath() at jsdom is
but other case is
so
event.composedPath().indexOf(window)
is away equal -1.the following code will skips the event handle and makes the test pass.
svelte/packages/svelte/src/internal/client/render.js
Lines 1430 to 1435 in 506196b
it seems to be jsdom's bug, there is no way to test this case in jsdom.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint