diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 0236f3a53c5276..6f1ade046577b2 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -305,7 +305,7 @@ class Event { if (!isEvent(this)) throw new ERR_INVALID_THIS('Event'); if (value) { - this.stopPropagation(); + this.#propagationStopped = true; } } diff --git a/test/parallel/test-eventtarget.js b/test/parallel/test-eventtarget.js index 193c47893b5a9e..aaead823d032b8 100644 --- a/test/parallel/test-eventtarget.js +++ b/test/parallel/test-eventtarget.js @@ -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); +}