Skip to content

Commit 399654f

Browse files
mert.altinmhdawson
mert.altin
authored andcommittedFeb 26, 2024·
events: no stopPropagation call in cancelBubble
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>
1 parent 60ce078 commit 399654f

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
@@ -306,7 +306,7 @@ class Event {
306306
if (!isEvent(this))
307307
throw new ERR_INVALID_THIS('Event');
308308
if (value) {
309-
this.stopPropagation();
309+
this.#propagationStopped = true;
310310
}
311311
}
312312

‎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)
Please sign in to comment.