@lwc/synthetic-shadow 3.0.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -14,10 +14,8 @@ import './polyfills/click-event-composed/main';
14
14
  import './polyfills/event-composed/main';
15
15
  import './polyfills/custom-event-composed/main';
16
16
  import './polyfills/clipboard-event-composed/main';
17
- import './polyfills/iframe-content-window/main';
18
17
  import './polyfills/mutation-observer/main';
19
18
  import './polyfills/event-target/main';
20
- import './polyfills/window-event-target/main';
21
19
  import './polyfills/event/main';
22
20
  import './polyfills/focus-event/main';
23
21
  import './polyfills/mouse-event/main';
package/dist/index.js CHANGED
@@ -112,17 +112,7 @@ const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
112
112
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
113
113
  const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
114
114
  const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
115
-
116
- /*
117
- * Copyright (c) 2018, salesforce.com, inc.
118
- * All rights reserved.
119
- * SPDX-License-Identifier: MIT
120
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
121
- */
122
- // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
123
- // we can't use typeof since it will fail when transpiling.
124
- const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
125
- /** version: 3.0.0 */
115
+ /** version: 3.0.2 */
126
116
 
127
117
  /**
128
118
  * Copyright (C) 2023 salesforce.com, inc.
@@ -131,7 +121,7 @@ const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === '
131
121
  if (!_globalThis.lwcRuntimeFlags) {
132
122
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
133
123
  }
134
- /** version: 3.0.0 */
124
+ /** version: 3.0.2 */
135
125
 
136
126
  /*
137
127
  * Copyright (c) 2018, salesforce.com, inc.
@@ -151,13 +141,9 @@ const lastChildGetter = getOwnPropertyDescriptor(nodePrototype, 'lastChild').get
151
141
  const textContentGetter = getOwnPropertyDescriptor(nodePrototype, 'textContent').get;
152
142
  const parentNodeGetter = getOwnPropertyDescriptor(nodePrototype, 'parentNode').get;
153
143
  const ownerDocumentGetter = getOwnPropertyDescriptor(nodePrototype, 'ownerDocument').get;
154
- const parentElementGetter = hasOwnProperty.call(nodePrototype, 'parentElement')
155
- ? getOwnPropertyDescriptor(nodePrototype, 'parentElement').get
156
- : getOwnPropertyDescriptor(HTMLElement.prototype, 'parentElement').get; // IE11
144
+ const parentElementGetter = getOwnPropertyDescriptor(nodePrototype, 'parentElement').get;
157
145
  const textContextSetter = getOwnPropertyDescriptor(nodePrototype, 'textContent').set;
158
- const childNodesGetter = hasOwnProperty.call(nodePrototype, 'childNodes')
159
- ? getOwnPropertyDescriptor(nodePrototype, 'childNodes').get
160
- : getOwnPropertyDescriptor(HTMLElement.prototype, 'childNodes').get; // IE11
146
+ const childNodesGetter = getOwnPropertyDescriptor(nodePrototype, 'childNodes').get;
161
147
  const isConnected = hasOwnProperty.call(nodePrototype, 'isConnected')
162
148
  ? getOwnPropertyDescriptor(nodePrototype, 'isConnected').get
163
149
  : function () {
@@ -200,26 +186,18 @@ const outerTextGetter = outerTextDescriptor
200
186
  const outerTextSetter = outerTextDescriptor
201
187
  ? outerTextDescriptor.set
202
188
  : null;
203
- const innerHTMLDescriptor = hasOwnProperty.call(Element.prototype, 'innerHTML')
204
- ? getOwnPropertyDescriptor(Element.prototype, 'innerHTML')
205
- : getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML'); // IE11
189
+ const innerHTMLDescriptor = getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
206
190
  const innerHTMLGetter = innerHTMLDescriptor.get;
207
191
  const innerHTMLSetter = innerHTMLDescriptor.set;
208
- const outerHTMLDescriptor = hasOwnProperty.call(Element.prototype, 'outerHTML')
209
- ? getOwnPropertyDescriptor(Element.prototype, 'outerHTML')
210
- : getOwnPropertyDescriptor(HTMLElement.prototype, 'outerHTML'); // IE11
192
+ const outerHTMLDescriptor = getOwnPropertyDescriptor(Element.prototype, 'outerHTML');
211
193
  const outerHTMLGetter = outerHTMLDescriptor.get;
212
194
  const outerHTMLSetter = outerHTMLDescriptor.set;
213
195
  const tagNameGetter = getOwnPropertyDescriptor(Element.prototype, 'tagName').get;
214
196
  const tabIndexDescriptor = getOwnPropertyDescriptor(HTMLElement.prototype, 'tabIndex');
215
197
  const tabIndexGetter = tabIndexDescriptor.get;
216
198
  const tabIndexSetter = tabIndexDescriptor.set;
217
- const matches = hasOwnProperty.call(Element.prototype, 'matches')
218
- ? Element.prototype.matches
219
- : Element.prototype.msMatchesSelector; // IE11
220
- const childrenGetter = hasOwnProperty.call(Element.prototype, 'children')
221
- ? getOwnPropertyDescriptor(Element.prototype, 'children').get
222
- : getOwnPropertyDescriptor(HTMLElement.prototype, 'children').get; // IE11
199
+ const matches = Element.prototype.matches;
200
+ const childrenGetter = getOwnPropertyDescriptor(Element.prototype, 'children').get;
223
201
  // for IE11, access from HTMLElement
224
202
  // for all other browsers access the method from the parent Element interface
225
203
  const { getElementsByClassName: getElementsByClassName$1 } = HTMLElement.prototype;
@@ -273,16 +251,12 @@ const composedPath = hasOwnProperty.call(Event.prototype, 'composedPath')
273
251
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
274
252
  */
275
253
  const DocumentPrototypeActiveElement = getOwnPropertyDescriptor(Document.prototype, 'activeElement').get;
276
- const elementFromPoint = hasOwnProperty.call(Document.prototype, 'elementFromPoint')
277
- ? Document.prototype.elementFromPoint
278
- : Document.prototype.msElementFromPoint; // IE11
279
- const elementsFromPoint = hasOwnProperty.call(Document.prototype, 'elementsFromPoint')
280
- ? Document.prototype.elementsFromPoint
281
- : Document.prototype.msElementsFromPoint; // IE11
254
+ const elementFromPoint = Document.prototype.elementFromPoint;
255
+ const elementsFromPoint = Document.prototype.elementsFromPoint;
282
256
  // defaultView can be null when a document has no browsing context. For example, the owner document
283
257
  // of a node in a template doesn't have a default view: https://jsfiddle.net/hv9z0q5a/
284
258
  const defaultViewGetter = getOwnPropertyDescriptor(Document.prototype, 'defaultView').get;
285
- const { createComment, querySelectorAll, getElementById, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, } = Document.prototype;
259
+ const { querySelectorAll, getElementById, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, } = Document.prototype;
286
260
  // In Firefox v57 and lower, getElementsByName is defined on HTMLDocument.prototype
287
261
  // In all other browsers have the method on Document.prototype
288
262
  const { getElementsByName } = HTMLDocument.prototype;
@@ -328,7 +302,7 @@ const isInstanceOfNativeShadowRoot = isNull(NativeShadowRoot)
328
302
  * SPDX-License-Identifier: MIT
329
303
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
330
304
  */
331
- function detect$4 () {
305
+ function detect$2 () {
332
306
  return typeof HTMLSlotElement === 'undefined';
333
307
  }
334
308
 
@@ -343,7 +317,7 @@ const CHAR_S = 115;
343
317
  const CHAR_L = 108;
344
318
  const CHAR_O = 111;
345
319
  const CHAR_T = 116;
346
- function apply$4() {
320
+ function apply$2() {
347
321
  // IE11 does not have this element definition
348
322
  // we don't care much about the construction phase, just the prototype
349
323
  class HTMLSlotElement {
@@ -378,8 +352,8 @@ function apply$4() {
378
352
  * SPDX-License-Identifier: MIT
379
353
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
380
354
  */
381
- if (detect$4()) {
382
- apply$4();
355
+ if (detect$2()) {
356
+ apply$2();
383
357
  }
384
358
 
385
359
  /*
@@ -1280,15 +1254,6 @@ function childNodesGetterPatched() {
1280
1254
  if (isSyntheticShadowHost(this)) {
1281
1255
  const owner = getNodeOwner(this);
1282
1256
  const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1283
- if (process.env.NODE_ENV !== 'production' &&
1284
- isFalse(hasNativeSymbolSupport) &&
1285
- isExternalChildNodeAccessorFlagOn()) {
1286
- // inserting a comment node as the first childNode to trick the IE11
1287
- // DevTool to show the content of the shadowRoot, this should only happen
1288
- // in dev-mode and in IE11 (which we detect by looking at the symbol).
1289
- // Plus it should only be in place if we know it is an external invoker.
1290
- ArrayUnshift.call(childNodes, getIE11FakeShadowRootPlaceholder(this));
1291
- }
1292
1257
  return createStaticNodeList(childNodes);
1293
1258
  }
1294
1259
  // nothing to do here since this does not have a synthetic shadow attached to it
@@ -1503,40 +1468,9 @@ defineProperties(_Node.prototype, {
1503
1468
  },
1504
1469
  },
1505
1470
  });
1506
- let internalChildNodeAccessorFlag = false;
1507
- /**
1508
- * These 2 methods are providing a machinery to understand who is accessing the
1509
- * .childNodes member property of a node. If it is used from inside the synthetic shadow
1510
- * or from an external invoker. This helps to produce the right output in one very peculiar
1511
- * case, the IE11 debugging comment for shadowRoot representation on the devtool.
1512
- */
1513
- function isExternalChildNodeAccessorFlagOn() {
1514
- return !internalChildNodeAccessorFlag;
1515
- }
1516
- const getInternalChildNodes = process.env.NODE_ENV !== 'production' && isFalse(hasNativeSymbolSupport)
1517
- ? function (node) {
1518
- internalChildNodeAccessorFlag = true;
1519
- let childNodes;
1520
- let error = null;
1521
- try {
1522
- childNodes = node.childNodes;
1523
- }
1524
- catch (e) {
1525
- // childNodes accessor should never throw, but just in case!
1526
- error = e;
1527
- }
1528
- finally {
1529
- internalChildNodeAccessorFlag = false;
1530
- if (!isNull(error)) {
1531
- // re-throwing after restoring the state machinery for setInternalChildNodeAccessorFlag
1532
- throw error; // eslint-disable-line no-unsafe-finally
1533
- }
1534
- }
1535
- return childNodes;
1536
- }
1537
- : function (node) {
1538
- return node.childNodes;
1539
- };
1471
+ const getInternalChildNodes = function (node) {
1472
+ return node.childNodes;
1473
+ };
1540
1474
  // IE11 extra patches for wrong prototypes
1541
1475
  if (hasOwnProperty.call(HTMLElement.prototype, 'contains')) {
1542
1476
  defineProperty(HTMLElement.prototype, 'contains', getOwnPropertyDescriptor(_Node.prototype, 'contains'));
@@ -2344,42 +2278,6 @@ defineProperty(SyntheticShadowRoot, Symbol.hasInstance, {
2344
2278
  getPrototypeOf(object) === SyntheticShadowRoot.prototype));
2345
2279
  },
2346
2280
  });
2347
- /**
2348
- * This method is only intended to be used in non-production mode in IE11
2349
- * and its role is to produce a 1-1 mapping between a shadowRoot instance
2350
- * and a comment node that is intended to use to trick the IE11 DevTools
2351
- * to show the content of the shadowRoot in the DOM Explorer.
2352
- */
2353
- function getIE11FakeShadowRootPlaceholder(host) {
2354
- const shadowRoot = getShadowRoot(host);
2355
- // @ts-ignore this $$placeholder$$ is not a security issue because you must
2356
- // have access to the shadowRoot in order to extract the fake node, which give
2357
- // you access to the same childNodes of the shadowRoot, so, who cares.
2358
- let c = shadowRoot.$$placeholder$$;
2359
- if (!isUndefined(c)) {
2360
- return c;
2361
- }
2362
- const doc = getOwnerDocument(host);
2363
- // @ts-ignore $$placeholder$$ is fine, read the node above.
2364
- c = shadowRoot.$$placeholder$$ = createComment.call(doc, '');
2365
- defineProperties(c, {
2366
- childNodes: {
2367
- get() {
2368
- return shadowRoot.childNodes;
2369
- },
2370
- enumerable: true,
2371
- configurable: true,
2372
- },
2373
- tagName: {
2374
- get() {
2375
- return `#shadow-root (${shadowRoot.mode})`;
2376
- },
2377
- enumerable: true,
2378
- configurable: true,
2379
- },
2380
- });
2381
- return c;
2382
- }
2383
2281
 
2384
2282
  /*
2385
2283
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2658,7 +2556,7 @@ Object.defineProperty(window, 'ShadowRoot', {
2658
2556
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2659
2557
  */
2660
2558
  const composedDescriptor = Object.getOwnPropertyDescriptor(Event.prototype, 'composed');
2661
- function detect$3() {
2559
+ function detect$1() {
2662
2560
  if (!composedDescriptor) {
2663
2561
  // No need to apply this polyfill if this client completely lacks
2664
2562
  // support for the composed property.
@@ -2690,7 +2588,7 @@ function handleClick(event) {
2690
2588
  },
2691
2589
  });
2692
2590
  }
2693
- function apply$3() {
2591
+ function apply$1() {
2694
2592
  HTMLElement.prototype.click = function () {
2695
2593
  addEventListener.call(this, 'click', handleClick);
2696
2594
  try {
@@ -2708,8 +2606,8 @@ function apply$3() {
2708
2606
  * SPDX-License-Identifier: MIT
2709
2607
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2710
2608
  */
2711
- if (detect$3()) {
2712
- apply$3();
2609
+ if (detect$1()) {
2610
+ apply$1();
2713
2611
  }
2714
2612
 
2715
2613
  /*
@@ -2718,7 +2616,7 @@ if (detect$3()) {
2718
2616
  * SPDX-License-Identifier: MIT
2719
2617
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2720
2618
  */
2721
- function detect$2() {
2619
+ function detect() {
2722
2620
  return new Event('test', { composed: true }).composed !== true;
2723
2621
  }
2724
2622
 
@@ -2728,7 +2626,7 @@ function detect$2() {
2728
2626
  * SPDX-License-Identifier: MIT
2729
2627
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2730
2628
  */
2731
- function apply$2() {
2629
+ function apply() {
2732
2630
  // https://github.com/w3c/webcomponents/issues/513#issuecomment-224183937
2733
2631
  const composedEvents = assign(create(null), {
2734
2632
  beforeinput: 1,
@@ -2822,8 +2720,8 @@ function apply$2() {
2822
2720
  * SPDX-License-Identifier: MIT
2823
2721
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2824
2722
  */
2825
- if (detect$2()) {
2826
- apply$2();
2723
+ if (detect()) {
2724
+ apply();
2827
2725
  }
2828
2726
 
2829
2727
  /*
@@ -2875,121 +2773,6 @@ if (typeof ClipboardEvent !== 'undefined') {
2875
2773
  });
2876
2774
  }
2877
2775
 
2878
- /*
2879
- * Copyright (c) 2018, salesforce.com, inc.
2880
- * All rights reserved.
2881
- * SPDX-License-Identifier: MIT
2882
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2883
- */
2884
- function detect$1() {
2885
- // Note: when using this in mobile apps, we might have a DOM that does not support iframes.
2886
- const hasIframe = typeof HTMLIFrameElement !== 'undefined';
2887
- // This polyfill should only apply in compat mode; see https://github.com/salesforce/lwc/issues/1513
2888
- const isCompat = typeof Proxy !== 'undefined' && isTrue(Proxy.isCompat);
2889
- return hasIframe && isCompat;
2890
- }
2891
-
2892
- /*
2893
- * Copyright (c) 2018, salesforce.com, inc.
2894
- * All rights reserved.
2895
- * SPDX-License-Identifier: MIT
2896
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2897
- */
2898
- function apply$1() {
2899
- // the iframe property descriptor for `contentWindow` should always be available, otherwise this method should never be called
2900
- const desc = getOwnPropertyDescriptor(HTMLIFrameElement.prototype, 'contentWindow');
2901
- const { get: originalGetter } = desc;
2902
- desc.get = function () {
2903
- const original = originalGetter.call(this);
2904
- // If the original iframe element is not a keyed node, then do not wrap it
2905
- if (isNull(original) || isUndefined(getNodeOwnerKey(this))) {
2906
- return original;
2907
- }
2908
- // only if the element is an iframe inside a shadowRoot, we care about this problem
2909
- // because in that case, the code that is accessing the iframe, is very likely code
2910
- // compiled with proxy-compat transformation. It is true that other code without those
2911
- // transformations might also access an iframe from within a shadowRoot, but in that,
2912
- // case, which is more rare, we still return the wrapper, and it should work the same,
2913
- // this part is just an optimization.
2914
- return wrapIframeWindow(original);
2915
- };
2916
- defineProperty(HTMLIFrameElement.prototype, 'contentWindow', desc);
2917
- }
2918
- function wrapIframeWindow(win) {
2919
- return {
2920
- addEventListener() {
2921
- // Typescript does not like it when you treat the `arguments` object as an array
2922
- // @ts-ignore type-mismatch
2923
- return win.addEventListener.apply(win, arguments);
2924
- },
2925
- blur() {
2926
- // Typescript does not like it when you treat the `arguments` object as an array
2927
- // @ts-ignore type-mismatch
2928
- return win.blur.apply(win, arguments);
2929
- },
2930
- close() {
2931
- // Typescript does not like it when you treat the `arguments` object as an array
2932
- // @ts-ignore type-mismatch
2933
- return win.close.apply(win, arguments);
2934
- },
2935
- focus() {
2936
- // Typescript does not like it when you treat the `arguments` object as an array
2937
- // @ts-ignore type-mismatch
2938
- return win.focus.apply(win, arguments);
2939
- },
2940
- postMessage() {
2941
- // Typescript does not like it when you treat the `arguments` object as an array
2942
- // @ts-ignore type-mismatch
2943
- return win.postMessage.apply(win, arguments);
2944
- },
2945
- removeEventListener() {
2946
- // Typescript does not like it when you treat the `arguments` object as an array
2947
- // @ts-ignore type-mismatch
2948
- return win.removeEventListener.apply(win, arguments);
2949
- },
2950
- get closed() {
2951
- return win.closed;
2952
- },
2953
- get frames() {
2954
- return win.frames;
2955
- },
2956
- get length() {
2957
- return win.length;
2958
- },
2959
- get location() {
2960
- return win.location;
2961
- },
2962
- set location(value) {
2963
- win.location = value;
2964
- },
2965
- get opener() {
2966
- return win.opener;
2967
- },
2968
- get parent() {
2969
- return win.parent;
2970
- },
2971
- get self() {
2972
- return win.self;
2973
- },
2974
- get top() {
2975
- return win.top;
2976
- },
2977
- get window() {
2978
- return win.window;
2979
- },
2980
- }; // this is limited
2981
- }
2982
-
2983
- /*
2984
- * Copyright (c) 2018, salesforce.com, inc.
2985
- * All rights reserved.
2986
- * SPDX-License-Identifier: MIT
2987
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2988
- */
2989
- if (detect$1()) {
2990
- apply$1();
2991
- }
2992
-
2993
2776
  /*
2994
2777
  * Copyright (c) 2018, salesforce.com, inc.
2995
2778
  * All rights reserved.
@@ -3231,7 +3014,7 @@ defineProperty(window, 'MutationObserver', {
3231
3014
  * SPDX-License-Identifier: MIT
3232
3015
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3233
3016
  */
3234
- function patchedAddEventListener$1(type, listener, optionsOrCapture) {
3017
+ function patchedAddEventListener(type, listener, optionsOrCapture) {
3235
3018
  if (isSyntheticShadowHost(this)) {
3236
3019
  // Typescript does not like it when you treat the `arguments` object as an array
3237
3020
  // @ts-ignore type-mismatch
@@ -3254,7 +3037,7 @@ function patchedAddEventListener$1(type, listener, optionsOrCapture) {
3254
3037
  // The third argument is optional, so passing in `undefined` for `optionsOrCapture` gives capture=false
3255
3038
  return addEventListener.call(this, type, wrappedListener, optionsOrCapture);
3256
3039
  }
3257
- function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
3040
+ function patchedRemoveEventListener(_type, _listener, _optionsOrCapture) {
3258
3041
  if (isSyntheticShadowHost(this)) {
3259
3042
  // Typescript does not like it when you treat the `arguments` object as an array
3260
3043
  // @ts-ignore type-mismatch
@@ -3274,87 +3057,19 @@ function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
3274
3057
  }
3275
3058
  defineProperties(eventTargetPrototype, {
3276
3059
  addEventListener: {
3277
- value: patchedAddEventListener$1,
3060
+ value: patchedAddEventListener,
3278
3061
  enumerable: true,
3279
3062
  writable: true,
3280
3063
  configurable: true,
3281
3064
  },
3282
3065
  removeEventListener: {
3283
- value: patchedRemoveEventListener$1,
3066
+ value: patchedRemoveEventListener,
3284
3067
  enumerable: true,
3285
3068
  writable: true,
3286
3069
  configurable: true,
3287
3070
  },
3288
3071
  });
3289
3072
 
3290
- /*
3291
- * Copyright (c) 2018, salesforce.com, inc.
3292
- * All rights reserved.
3293
- * SPDX-License-Identifier: MIT
3294
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3295
- */
3296
- function detect() {
3297
- return typeof EventTarget === 'undefined';
3298
- }
3299
-
3300
- /*
3301
- * Copyright (c) 2018, salesforce.com, inc.
3302
- * All rights reserved.
3303
- * SPDX-License-Identifier: MIT
3304
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3305
- */
3306
- function patchedAddEventListener(_type, _listener, _options) {
3307
- if (arguments.length > 1) {
3308
- const args = ArraySlice.call(arguments);
3309
- args[1] = getEventListenerWrapper(args[1]);
3310
- // Ignore types because we're passing through to native method
3311
- // @ts-ignore type-mismatch
3312
- return windowAddEventListener.apply(this, args);
3313
- }
3314
- // Typescript does not like it when you treat the `arguments` object as an array
3315
- // @ts-ignore type-mismatch
3316
- return windowAddEventListener.apply(this, arguments);
3317
- }
3318
- function patchedRemoveEventListener(_type, _listener, _options) {
3319
- if (arguments.length > 1) {
3320
- const args = ArraySlice.call(arguments);
3321
- args[1] = getEventListenerWrapper(args[1]);
3322
- // Ignore types because we're passing through to native method
3323
- // @ts-ignore type-mismatch
3324
- windowRemoveEventListener.apply(this, args);
3325
- }
3326
- // Account for listeners that were added before this polyfill was applied
3327
- // Typescript does not like it when you treat the `arguments` object as an array
3328
- // @ts-ignore type-mismatch
3329
- windowRemoveEventListener.apply(this, arguments);
3330
- }
3331
- function apply() {
3332
- defineProperties(Window.prototype, {
3333
- addEventListener: {
3334
- value: patchedAddEventListener,
3335
- enumerable: true,
3336
- writable: true,
3337
- configurable: true,
3338
- },
3339
- removeEventListener: {
3340
- value: patchedRemoveEventListener,
3341
- enumerable: true,
3342
- writable: true,
3343
- configurable: true,
3344
- },
3345
- });
3346
- }
3347
-
3348
- /*
3349
- * Copyright (c) 2018, salesforce.com, inc.
3350
- * All rights reserved.
3351
- * SPDX-License-Identifier: MIT
3352
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3353
- */
3354
- if (detect()) {
3355
- apply();
3356
- }
3357
-
3358
3073
  /*
3359
3074
  * Copyright (c) 2018, salesforce.com, inc.
3360
3075
  * All rights reserved.
@@ -4750,5 +4465,5 @@ defineProperty(Element.prototype, '$domManual$', {
4750
4465
  },
4751
4466
  configurable: true,
4752
4467
  });
4753
- /** version: 3.0.0 */
4468
+ /** version: 3.0.2 */
4754
4469
  //# sourceMappingURL=index.js.map