Skip to content

Commit

Permalink
events: no stopPropagation call in cancelBubble
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mert.altin authored and richardlau committed Mar 25, 2024
1 parent 6bf148e commit d9b5cd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class Event {
if (!isEvent(this))
throw new ERR_INVALID_THIS('Event');
if (value) {
this.stopPropagation();
this.#propagationStopped = true;
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,3 +738,10 @@ let asyncTest = Promise.resolve();
controller.abort();
et.dispatchEvent(new Event('foo'));
}

{
const event = new Event('foo');
strictEqual(event.cancelBubble, false);
event.cancelBubble = true;
strictEqual(event.cancelBubble, true);
}

0 comments on commit d9b5cd5

Please sign in to comment.