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

Fix event dispatch #5

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Fix event dispatch #5

merged 2 commits into from
Jan 19, 2024

Conversation

francisbouvier
Copy link
Member

No description provided.

As per the standard dispatch event should only invoke the handler if
event's buubles is true:
if event’s bubbles is true, all the object’s inclusive ancestor event listeners whose capture is false are invoked, now in reverse tree order.
https://dom.spec.whatwg.org/#events

Signed-off-by: Francis Bouvier <[email protected]>
The standard is not very clear about that.

On the general description of
events (https://dom.spec.whatwg.org/#events) it says "all the object’s
inclusive ancestor event listeners whose capture is true are invoked"
for capturing and bubbling phases. So the target itself *should be included*.

But later when describing the
phases (https://dom.spec.whatwg.org/#dom-event-eventphase) it says
that capturing phase is _before_ the target and bubbling phase is
_after_ the target. So the target itself *should not be included*.

The behavior of modern web browsers (Chrome/Firefox) do not include
the target in capturing/bubbling phase so let's follow that.

Signed-off-by: Francis Bouvier <[email protected]>
@francisbouvier francisbouvier merged commit e50dd2b into master Jan 19, 2024
4 of 5 checks passed
@francisbouvier francisbouvier deleted the fix_event_dispatch branch January 19, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants