@@ -35,12 +35,13 @@ class Event {
3535 #cancelable = false ;
3636 #timestamp = perf_hooks . performance . now ( ) ;
3737
38- // Neither of these are currently used in the Node.js implementation
38+ // None of these are currently used in the Node.js implementation
3939 // of EventTarget because there is no concept of bubbling or
4040 // composition. We preserve their values in Event but they are
4141 // non-ops and do not carry any semantics in Node.js
4242 #bubbles = false ;
4343 #composed = false ;
44+ #propagationStopped = false ;
4445
4546
4647 constructor ( type , options ) {
@@ -51,6 +52,7 @@ class Event {
5152 this . #bubbles = ! ! bubbles ;
5253 this . #composed = ! ! composed ;
5354 this . #type = `${ type } ` ;
55+ this . #propagationStopped = false ;
5456 // isTrusted is special (LegacyUnforgeable)
5557 Object . defineProperty ( this , 'isTrusted' , {
5658 get ( ) { return false ; } ,
@@ -109,11 +111,14 @@ class Event {
109111 get eventPhase ( ) {
110112 return this [ kTarget ] ? 2 : 0 ; // Equivalent to AT_TARGET or NONE
111113 }
112- cancelBubble ( ) {
113- // Non-op in Node.js. Alias for stopPropagation
114+ get cancelBubble ( ) { return this . #propagationStopped; }
115+ set cancelBubble ( value ) {
116+ if ( value ) {
117+ this . stopPropagation ( ) ;
118+ }
114119 }
115120 stopPropagation ( ) {
116- // Non-op in Node.js
121+ this . #propagationStopped = true ;
117122 }
118123
119124 get [ Symbol . toStringTag ] ( ) { return 'Event' ; }
0 commit comments