Skip to content

Commit d9b5cd5

Browse files
mert.altinrichardlau
mert.altin
authored andcommitted
events: no stopPropagation call in cancelBubble
PR-URL: #50405 Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 6bf148e commit d9b5cd5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/internal/event_target.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class Event {
310310
if (!isEvent(this))
311311
throw new ERR_INVALID_THIS('Event');
312312
if (value) {
313-
this.stopPropagation();
313+
this.#propagationStopped = true;
314314
}
315315
}
316316

test/parallel/test-eventtarget.js

+7
Original file line numberDiff line numberDiff line change
@@ -738,3 +738,10 @@ let asyncTest = Promise.resolve();
738738
controller.abort();
739739
et.dispatchEvent(new Event('foo'));
740740
}
741+
742+
{
743+
const event = new Event('foo');
744+
strictEqual(event.cancelBubble, false);
745+
event.cancelBubble = true;
746+
strictEqual(event.cancelBubble, true);
747+
}

0 commit comments

Comments
 (0)