Skip to content

events: setting event cancelBubble calls stopPropagation - #50405

Closed
mertcanaltin wants to merge 3 commits into
nodejs:mainfrom
mertcanaltin:dev-50401
Closed

events: setting event cancelBubble calls stopPropagation#50405
mertcanaltin wants to merge 3 commits into
nodejs:mainfrom
mertcanaltin:dev-50401

Conversation

@mertcanaltin

Copy link
Copy Markdown
Member

issue: #50401

In this issue, we addressed the problem where setting cancelBubble to true unintentionally called the stopPropagation method. The solution ensures that stopPropagation is only called when cancelBubble is explicitly set to false, as it should be. This change prevents the method from being called when cancelBubble is true or not explicitly set

@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label Oct 26, 2023
@mertcanaltinmertcanaltin added events Issues and PRs related to the events subsystem / EventEmitter. eventtarget Issues and PRs related to the EventTarget implementation. labels Oct 26, 2023
Comment threadlib/internal/event_target.js Outdated
Co-authored-by: Deokjin Kim <deokjin81.kim@gmail.com>
@anonrig

Copy link
Copy Markdown
Member

Can you add a test?

@benjamingrbenjamingr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test, changes lgtm

@mertcanaltin

mertcanaltin commented Nov 12, 2023

Copy link
Copy Markdown
MemberAuthor

ı added a test

throw new ERR_INVALID_THIS('Event');
if (value) {
this.stopPropagation();
this.#propagationStopped = true;

@jeanbernjeanbernNov 16, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is setting cancelBubble supposed to be one-way? The proposed change doesn't modify this.#propagationStopped when value is false

nvm: For anyone else wondering the same thing see here: whatwg/dom#211

@deokjinkimdeokjinkim added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 9, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 9, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mertcanaltin

Copy link
Copy Markdown
MemberAuthor

I wonder if I should do an update here?

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mertcanaltinmertcanaltin added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 3, 2024
@mertcanaltinmertcanaltin removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 3, 2024
@mertcanaltin

Copy link
Copy Markdown
MemberAuthor

I guess flakky was the test 🤔 💭

@benjamingrbenjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 6, 2024
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 6, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mertcanaltinmertcanaltin added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 17, 2024
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 17, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mertcanaltin

Copy link
Copy Markdown
MemberAuthor

passed 🎉🚀

@mertcanaltin

Copy link
Copy Markdown
MemberAuthor

@benjamingr I would be very happy if you can make an update here, now it seems to have passed all the tests

@mertcanaltinmertcanaltin added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 18, 2024

@mhdawsonmhdawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhdawson

Copy link
Copy Markdown
Member

@mertcanaltin I'm getting this warnings when landing -
GitHub cannot link the author of 'events: setting event cancelBubble calls stopPropagation' to their GitHub account.
⚠ Please suggest them to take a look at https://github.com/nodejs/node/blob/99b1ada/doc/guides/contributing/pull-requests.md#step-1-fork

Can you take a look? I'll land anyway but would be good to get that fixed up.

mhdawson pushed a commit that referenced this pull request Feb 26, 2024
PR-URL: #50405
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@mhdawson

Copy link
Copy Markdown
Member

Landed in 399654f

@mertcanaltin

Copy link
Copy Markdown
MemberAuthor

I am very sorry for the late response, thank you very much for correcting me @mhdawson ❤️ 🚀

marco-ippolito pushed a commit that referenced this pull request Feb 27, 2024
PR-URL: #50405
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@marco-ippolitomarco-ippolito mentioned this pull request Mar 1, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #50405
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@richardlaurichardlau mentioned this pull request Mar 25, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.eventsIssues and PRs related to the events subsystem / EventEmitter.eventtargetIssues and PRs related to the EventTarget implementation.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@mertcanaltin@anonrig@nodejs-github-bot@mhdawson@jasnell@jeanbern@benjamingr@deokjinkim@KhafraDev