Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ class Event {
stopImmediatePropagation() {
if (!isEvent(this))
throw new ERR_INVALID_THIS('Event');
// Spec mention "stopImmediatePropagation should set both "stop propagation"
// and "stop immediate propagation" flags"
// cf: from https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation
this.stopPropagation();
this[kStop] = true;
}

Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ let asyncTest = Promise.resolve();
{
const target = new EventTarget();
const event = new Event('foo');
strictEqual(event.cancelBubble, false);
event.stopImmediatePropagation();
strictEqual(event.cancelBubble, true);
target.addEventListener('foo', common.mustNotCall());
target.dispatchEvent(event);
}
Expand Down