File tree 3 files changed +34
-8
lines changed
3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -2086,6 +2086,22 @@ added: v14.5.0
2086
2086
2087
2087
This is not used in Node.js and is provided purely for completeness.
2088
2088
2089
+ #### ` event.initEvent(type[, bubbles[, cancelable]]) `
2090
+
2091
+ <!-- YAML
2092
+ added: REPLACEME
2093
+ -->
2094
+
2095
+ > Stability: 3 - Legacy: The WHATWG spec considers it deprecated and users
2096
+ > shouldn't use it at all.
2097
+
2098
+ * ` type ` {string}
2099
+ * ` bubbles ` {boolean}
2100
+ * ` cancelable ` {boolean}
2101
+
2102
+ Redundant with event constructors and incapable of setting ` composed ` .
2103
+ This is not used in Node.js and is provided purely for completeness.
2104
+
2089
2105
#### ` event.isTrusted `
2090
2106
2091
2107
<!-- YAML
Original file line number Diff line number Diff line change @@ -123,6 +123,23 @@ class Event {
123
123
this [ kIsBeingDispatched ] = false ;
124
124
}
125
125
126
+ /**
127
+ * @param {string } type
128
+ * @param {boolean } [bubbles]
129
+ * @param {boolean } [cancelable]
130
+ */
131
+ initEvent ( type , bubbles = false , cancelable = false ) {
132
+ if ( arguments . length === 0 )
133
+ throw new ERR_MISSING_ARGS ( 'type' ) ;
134
+
135
+ if ( this [ kIsBeingDispatched ] ) {
136
+ return ;
137
+ }
138
+ this [ kType ] = `${ type } ` ;
139
+ this . #bubbles = ! ! bubbles ;
140
+ this . #cancelable = ! ! cancelable ;
141
+ }
142
+
126
143
[ customInspectSymbol ] ( depth , options ) {
127
144
if ( ! isEvent ( this ) )
128
145
throw new ERR_INVALID_THIS ( 'Event' ) ;
@@ -307,6 +324,7 @@ ObjectDefineProperties(
307
324
configurable : true ,
308
325
value : 'Event' ,
309
326
} ,
327
+ initEvent : kEnumerableProperty ,
310
328
stopImmediatePropagation : kEnumerableProperty ,
311
329
preventDefault : kEnumerableProperty ,
312
330
target : kEnumerableProperty ,
Original file line number Diff line number Diff line change 8
8
]
9
9
}
10
10
},
11
- "Event-constructors.any.js" : {
12
- "fail" : {
13
- "expected" : [
14
- " Untitled 3" ,
15
- " Untitled 4"
16
- ]
17
- }
18
- },
19
11
"Event-dispatch-listener-order.window.js" : {
20
12
"skip" : " document is not defined"
21
13
},
You can’t perform that action at this time.
0 commit comments