@@ -133,7 +133,7 @@ export function addTrappedEventListener(
133
133
targetContainer : EventTarget ,
134
134
topLevelType : DOMTopLevelEventType ,
135
135
capture : boolean ,
136
- legacyFBSupport ?: boolean ,
136
+ isDeferredListenerForLegacyFBSupport ?: boolean ,
137
137
passive ?: boolean ,
138
138
priority ?: EventPriority ,
139
139
) : any => void {
@@ -161,7 +161,7 @@ export function addTrappedEventListener(
161
161
passive = false ;
162
162
}
163
163
const eventSystemFlags =
164
- enableLegacyFBSupport && legacyFBSupport
164
+ enableLegacyFBSupport && isDeferredListenerForLegacyFBSupport
165
165
? PLUGIN_EVENT_SYSTEM | LEGACY_FB_SUPPORT
166
166
: PLUGIN_EVENT_SYSTEM ;
167
167
@@ -182,8 +182,8 @@ export function addTrappedEventListener(
182
182
targetContainer = document ;
183
183
}
184
184
185
- const targetContainerToUse =
186
- enableLegacyFBSupport && legacyFBSupport
185
+ targetContainer =
186
+ enableLegacyFBSupport && isDeferredListenerForLegacyFBSupport
187
187
? ( targetContainer : any ) . ownerDocument
188
188
: targetContainer ;
189
189
@@ -201,14 +201,14 @@ export function addTrappedEventListener(
201
201
// browsers do not support this today, and given this is
202
202
// to support legacy code patterns, it's likely they'll
203
203
// need support for such browsers.
204
- if ( enableLegacyFBSupport && legacyFBSupport ) {
204
+ if ( enableLegacyFBSupport && isDeferredListenerForLegacyFBSupport ) {
205
205
const originalListener = listener ;
206
206
listener = function ( ...p ) {
207
207
try {
208
208
return originalListener . apply ( this , p ) ;
209
209
} finally {
210
210
removeEventListener (
211
- targetContainerToUse ,
211
+ targetContainer ,
212
212
rawEventName ,
213
213
unsubscribeListener ,
214
214
capture ,
@@ -220,14 +220,14 @@ export function addTrappedEventListener(
220
220
if ( enableUseEventAPI && passive !== undefined ) {
221
221
// This is only used with passive is either true or false.
222
222
unsubscribeListener = addEventCaptureListenerWithPassiveFlag (
223
- targetContainerToUse ,
223
+ targetContainer ,
224
224
rawEventName ,
225
225
listener ,
226
226
passive ,
227
227
) ;
228
228
} else {
229
229
unsubscribeListener = addEventCaptureListener (
230
- targetContainerToUse ,
230
+ targetContainer ,
231
231
rawEventName ,
232
232
listener ,
233
233
) ;
@@ -236,14 +236,14 @@ export function addTrappedEventListener(
236
236
if ( enableUseEventAPI && passive !== undefined ) {
237
237
// This is only used with passive is either true or false.
238
238
unsubscribeListener = addEventBubbleListenerWithPassiveFlag (
239
- targetContainerToUse ,
239
+ targetContainer ,
240
240
rawEventName ,
241
241
listener ,
242
242
passive ,
243
243
) ;
244
244
} else {
245
245
unsubscribeListener = addEventBubbleListener (
246
- targetContainerToUse ,
246
+ targetContainer ,
247
247
rawEventName ,
248
248
listener ,
249
249
) ;
0 commit comments