File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,13 @@ class Event {
51
51
this . #bubbles = ! ! bubbles ;
52
52
this . #composed = ! ! composed ;
53
53
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
+ } ) ;
54
61
}
55
62
56
63
[ customInspectSymbol ] ( depth , options ) {
@@ -99,7 +106,6 @@ class Event {
99
106
get returnValue ( ) { return ! this . defaultPrevented ; }
100
107
get bubbles ( ) { return this . #bubbles; }
101
108
get composed ( ) { return this . #composed; }
102
- get isTrusted ( ) { return false ; }
103
109
get eventPhase ( ) {
104
110
return this [ kTarget ] ? 2 : 0 ; // Equivalent to AT_TARGET or NONE
105
111
}
Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ ok(EventTarget);
50
50
ev . preventDefault ( ) ;
51
51
strictEqual ( ev . defaultPrevented , true ) ;
52
52
}
53
-
53
+ {
54
+ const ev = new Event ( 'foo' ) ;
55
+ deepStrictEqual ( Object . keys ( ev ) , [ 'isTrusted' ] ) ;
56
+ }
54
57
{
55
58
const eventTarget = new EventTarget ( ) ;
56
59
You can’t perform that action at this time.
0 commit comments