Skip to content
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

test(runtime-dom): avoid dispatchEvent and bindEvent in the same loop #7133

Closed
wants to merge 1 commit into from

Conversation

godxiaoji
Copy link
Contributor

Refer to: https://github.com/vuejs/core/actions/runs/3458391480/jobs/5772768354

In test:

patchProp(child, 'onClick', null, () => {
  childFn()
  patchProp(el, 'onClick', null, parentFn)
})
child.dispatchEvent(new Event('click', { bubbles: true }))

The above code (including the event handler) is executed in the same loop in nodejs.

Because use the same timestamp for all event listeners attached in the same tick in createInvoker.
The attached timestamp of parentFn event will be earlier than the bubble event.
So the parentFn will have been called.

To avoid unstable tests, move dispatchEvent to next loop.

@pikax
Copy link
Member

pikax commented Oct 25, 2023

@pikax pikax closed this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

2 participants