File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,13 @@ class Event {
5151 this . #bubbles = ! ! bubbles ;
5252 this . #composed = ! ! composed ;
5353 this . #type = String ( type ) ;
54+ // isTrusted is special (LegacyUnforgeable)
55+ Object . defineProperty ( this , 'isTrusted' , {
56+ get ( ) { return false ; } ,
57+ set ( ignoredValue ) { return false ; } ,
58+ enumerable : true ,
59+ configurable : false
60+ } ) ;
5461 }
5562
5663 [ customInspectSymbol ] ( depth , options ) {
@@ -99,7 +106,6 @@ class Event {
99106 get returnValue ( ) { return ! this . defaultPrevented ; }
100107 get bubbles ( ) { return this . #bubbles; }
101108 get composed ( ) { return this . #composed; }
102- get isTrusted ( ) { return false ; }
103109 get eventPhase ( ) {
104110 return this [ kTarget ] ? 2 : 0 ; // Equivalent to AT_TARGET or NONE
105111 }
Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ ok(EventTarget);
5050 ev . preventDefault ( ) ;
5151 strictEqual ( ev . defaultPrevented , true ) ;
5252}
53-
53+ {
54+ const ev = new Event ( 'foo' ) ;
55+ deepStrictEqual ( Object . keys ( ev ) , [ 'isTrusted' ] ) ;
56+ }
5457{
5558 const eventTarget = new EventTarget ( ) ;
5659
You can’t perform that action at this time.
0 commit comments