lwc 2.31.1 → 2.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +237 -264
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +237 -264
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +109 -160
  5. package/dist/engine-dom/iife/es5/engine-dom.js +233 -242
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +142 -199
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +237 -264
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +109 -160
  11. package/dist/engine-dom/umd/es5/engine-dom.js +233 -242
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +142 -199
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +218 -224
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +218 -224
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +85 -345
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +85 -345
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +85 -345
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +85 -345
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -108,7 +108,7 @@
108
108
  var KEY__SHADOW_TOKEN = '$shadowToken$';
109
109
  var KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
110
110
  var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
111
- /** version: 2.31.1 */
111
+ /** version: 2.32.1 */
112
112
 
113
113
  /*
114
114
  * Copyright (c) 2018, salesforce.com, inc.
@@ -270,9 +270,7 @@
270
270
  */
271
271
  var _window = window,
272
272
  windowAddEventListener = _window.addEventListener,
273
- windowRemoveEventListener = _window.removeEventListener,
274
- windowGetComputedStyle = _window.getComputedStyle,
275
- windowGetSelection = _window.getSelection;
273
+ windowRemoveEventListener = _window.removeEventListener;
276
274
 
277
275
  /*
278
276
  * Copyright (c) 2018, salesforce.com, inc.
@@ -382,7 +380,8 @@
382
380
  return win;
383
381
  }
384
382
  var skipGlobalPatching;
385
- // TODO [#1222]: remove global bypass
383
+ // Note: we deviate from native shadow here, but are not fixing
384
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
386
385
  function isGlobalPatchingSkipped(node) {
387
386
  // we lazily compute this value instead of doing it during evaluation, this helps
388
387
  // for apps that are setting this after the engine code is evaluated.
@@ -423,7 +422,7 @@
423
422
  });
424
423
  }
425
424
  var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
426
- /** version: 2.31.1 */
425
+ /** version: 2.32.1 */
427
426
 
428
427
  /*
429
428
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1266,17 +1265,12 @@
1266
1265
  },
1267
1266
  textContent: {
1268
1267
  get: function get() {
1269
- if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1270
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1271
- return textContentGetterPatched.call(this);
1272
- }
1273
- return textContentGetter.call(this);
1274
- }
1275
- // TODO [#1222]: remove global bypass
1276
- if (isGlobalPatchingSkipped(this)) {
1277
- return textContentGetter.call(this);
1268
+ // Note: we deviate from native shadow here, but are not fixing
1269
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1270
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1271
+ return textContentGetterPatched.call(this);
1278
1272
  }
1279
- return textContentGetterPatched.call(this);
1273
+ return textContentGetter.call(this);
1280
1274
  },
1281
1275
  set: textContentSetterPatched,
1282
1276
  enumerable: true,
@@ -1337,7 +1331,8 @@
1337
1331
  },
1338
1332
  compareDocumentPosition: {
1339
1333
  value: function value(otherNode) {
1340
- // TODO [#1222]: remove global bypass
1334
+ // Note: we deviate from native shadow here, but are not fixing
1335
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1341
1336
  if (isGlobalPatchingSkipped(this)) {
1342
1337
  return compareDocumentPosition.call(this, otherNode);
1343
1338
  }
@@ -1356,20 +1351,15 @@
1356
1351
  if (this === otherNode) {
1357
1352
  return true;
1358
1353
  }
1359
- if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1360
- if (otherNode == null) {
1361
- return false;
1362
- }
1363
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1364
- return containsPatched.call(this, otherNode);
1365
- }
1366
- return contains.call(this, otherNode);
1354
+ // Note: we deviate from native shadow here, but are not fixing
1355
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1356
+ if (otherNode == null) {
1357
+ return false;
1367
1358
  }
1368
- // TODO [#1222]: remove global bypass
1369
- if (isGlobalPatchingSkipped(this)) {
1370
- return contains.call(this, otherNode);
1359
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1360
+ return containsPatched.call(this, otherNode);
1371
1361
  }
1372
- return containsPatched.call(this, otherNode);
1362
+ return contains.call(this, otherNode);
1373
1363
  },
1374
1364
  enumerable: true,
1375
1365
  writable: true,
@@ -1377,17 +1367,9 @@
1377
1367
  },
1378
1368
  cloneNode: {
1379
1369
  value: function value(deep) {
1380
- if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1381
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1382
- return cloneNodePatched.call(this, deep);
1383
- }
1384
- return cloneNode.call(this, deep);
1385
- }
1386
- if (isTrue(deep)) {
1387
- // TODO [#1222]: remove global bypass
1388
- if (isGlobalPatchingSkipped(this)) {
1389
- return cloneNode.call(this, deep);
1390
- }
1370
+ // Note: we deviate from native shadow here, but are not fixing
1371
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1372
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1391
1373
  return cloneNodePatched.call(this, deep);
1392
1374
  }
1393
1375
  return cloneNode.call(this, deep);
@@ -2324,7 +2306,8 @@
2324
2306
  if (isNull(elm)) {
2325
2307
  return null;
2326
2308
  }
2327
- // TODO [#1222]: remove global bypass
2309
+ // Note: we deviate from native shadow here, but are not fixing
2310
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2328
2311
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm) ? elm : null;
2329
2312
  },
2330
2313
  writable: true,
@@ -2335,7 +2318,8 @@
2335
2318
  value: function value() {
2336
2319
  var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
2337
2320
  var filtered = ArrayFind.call(elements,
2338
- // TODO [#1222]: remove global bypass
2321
+ // Note: we deviate from native shadow here, but are not fixing
2322
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2339
2323
  function (elm) {
2340
2324
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2341
2325
  });
@@ -2349,7 +2333,8 @@
2349
2333
  value: function value() {
2350
2334
  var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
2351
2335
  var filtered = ArrayFilter.call(elements,
2352
- // TODO [#1222]: remove global bypass
2336
+ // Note: we deviate from native shadow here, but are not fixing
2337
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2353
2338
  function (elm) {
2354
2339
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2355
2340
  });
@@ -2363,7 +2348,8 @@
2363
2348
  value: function value() {
2364
2349
  var elements = arrayFromCollection(getElementsByClassName.apply(this, ArraySlice.call(arguments)));
2365
2350
  var filtered = ArrayFilter.call(elements,
2366
- // TODO [#1222]: remove global bypass
2351
+ // Note: we deviate from native shadow here, but are not fixing
2352
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2367
2353
  function (elm) {
2368
2354
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2369
2355
  });
@@ -2377,7 +2363,8 @@
2377
2363
  value: function value() {
2378
2364
  var elements = arrayFromCollection(getElementsByTagName.apply(this, ArraySlice.call(arguments)));
2379
2365
  var filtered = ArrayFilter.call(elements,
2380
- // TODO [#1222]: remove global bypass
2366
+ // Note: we deviate from native shadow here, but are not fixing
2367
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2381
2368
  function (elm) {
2382
2369
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2383
2370
  });
@@ -2391,7 +2378,8 @@
2391
2378
  value: function value() {
2392
2379
  var elements = arrayFromCollection(getElementsByTagNameNS.apply(this, ArraySlice.call(arguments)));
2393
2380
  var filtered = ArrayFilter.call(elements,
2394
- // TODO [#1222]: remove global bypass
2381
+ // Note: we deviate from native shadow here, but are not fixing
2382
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2395
2383
  function (elm) {
2396
2384
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2397
2385
  });
@@ -2407,7 +2395,8 @@
2407
2395
  value: function value() {
2408
2396
  var elements = arrayFromCollection(getElementsByName.apply(this, ArraySlice.call(arguments)));
2409
2397
  var filtered = ArrayFilter.call(elements,
2410
- // TODO [#1222]: remove global bypass
2398
+ // Note: we deviate from native shadow here, but are not fixing
2399
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2411
2400
  function (elm) {
2412
2401
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2413
2402
  });
@@ -3502,7 +3491,8 @@
3502
3491
  } else if (context instanceof HTMLBodyElement) {
3503
3492
  // `context` is document.body which is already patched.
3504
3493
  filtered = ArrayFilter.call(unfilteredNodes,
3505
- // TODO [#1222]: remove global bypass
3494
+ // Note: we deviate from native shadow here, but are not fixing
3495
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3506
3496
  function (elm) {
3507
3497
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
3508
3498
  });
@@ -3568,17 +3558,12 @@
3568
3558
  defineProperties(Element.prototype, {
3569
3559
  innerHTML: {
3570
3560
  get: function get() {
3571
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
3572
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3573
- return innerHTMLGetterPatched.call(this);
3574
- }
3575
- return innerHTMLGetter.call(this);
3561
+ // Note: we deviate from native shadow here, but are not fixing
3562
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3563
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3564
+ return innerHTMLGetterPatched.call(this);
3576
3565
  }
3577
- // TODO [#1222]: remove global bypass
3578
- if (isGlobalPatchingSkipped(this)) {
3579
- return innerHTMLGetter.call(this);
3580
- }
3581
- return innerHTMLGetterPatched.call(this);
3566
+ return innerHTMLGetter.call(this);
3582
3567
  },
3583
3568
  set: function set(v) {
3584
3569
  innerHTMLSetter.call(this, v);
@@ -3588,17 +3573,12 @@
3588
3573
  },
3589
3574
  outerHTML: {
3590
3575
  get: function get() {
3591
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
3592
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3593
- return outerHTMLGetterPatched.call(this);
3594
- }
3595
- return outerHTMLGetter.call(this);
3596
- }
3597
- // TODO [#1222]: remove global bypass
3598
- if (isGlobalPatchingSkipped(this)) {
3599
- return outerHTMLGetter.call(this);
3576
+ // Note: we deviate from native shadow here, but are not fixing
3577
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3578
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3579
+ return outerHTMLGetterPatched.call(this);
3600
3580
  }
3601
- return outerHTMLGetterPatched.call(this);
3581
+ return outerHTMLGetter.call(this);
3602
3582
  },
3603
3583
  set: function set(v) {
3604
3584
  outerHTMLSetter.call(this, v);
@@ -3700,35 +3680,24 @@
3700
3680
  });
3701
3681
  return isUndefined(elm) ? null : elm;
3702
3682
  } else {
3703
- if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3704
- // `this` is a manually inserted element inside a shadowRoot, return the first element.
3705
- return nodeList.length === 0 ? null : nodeList[0];
3706
- }
3707
- // Element is inside a shadow but we dont know which one. Use the
3708
- // "nearest" owner key to filter by ownership.
3709
- var contextNearestOwnerKey = getNodeNearestOwnerKey(this);
3710
- var _elm = ArrayFind.call(nodeList, function (elm) {
3711
- return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
3712
- });
3713
- return isUndefined(_elm) ? null : _elm;
3683
+ // Note: we deviate from native shadow here, but are not fixing
3684
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3685
+ // `this` is a manually inserted element inside a shadowRoot, return the first element.
3686
+ return nodeList.length === 0 ? null : nodeList[0];
3714
3687
  }
3715
3688
  } else {
3716
- if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3717
- if (!(this instanceof HTMLBodyElement)) {
3718
- var _elm3 = nodeList[0];
3719
- return isUndefined(_elm3) ? null : _elm3;
3720
- }
3689
+ if (!(this instanceof HTMLBodyElement)) {
3690
+ var _elm2 = nodeList[0];
3691
+ return isUndefined(_elm2) ? null : _elm2;
3721
3692
  }
3722
3693
  // element belonging to the document
3723
- var _elm2 = ArrayFind.call(nodeList,
3724
- // TODO [#1222]: remove global bypass
3725
- function (elm) {
3694
+ var _elm = ArrayFind.call(nodeList, function (elm) {
3726
3695
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(_this3);
3727
3696
  });
3728
- return isUndefined(_elm2) ? null : _elm2;
3697
+ return isUndefined(_elm) ? null : _elm;
3729
3698
  }
3730
3699
  }
3731
- function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
3700
+ function getFilteredArrayOfNodes(context, unfilteredNodes) {
3732
3701
  var filtered;
3733
3702
  if (isSyntheticShadowHost(context)) {
3734
3703
  // element with shadowRoot attached
@@ -3750,22 +3719,16 @@
3750
3719
  filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
3751
3720
  return getNodeNearestOwnerKey(elm) === ownerKey;
3752
3721
  });
3753
- } else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
3754
- // context is inside a shadow, we dont know which one.
3755
- var contextNearestOwnerKey = getNodeNearestOwnerKey(context);
3756
- filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
3757
- return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
3758
- });
3759
3722
  } else {
3760
- // context is manually inserted without lwc:dom-manual and ShadowDomSemantics is off, return everything
3723
+ // Note: we deviate from native shadow here, but are not fixing
3724
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3725
+ // context is manually inserted without lwc:dom-manual, return everything
3761
3726
  filtered = ArraySlice.call(unfilteredNodes);
3762
3727
  }
3763
3728
  } else {
3764
- if (context instanceof HTMLBodyElement || shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
3729
+ if (context instanceof HTMLBodyElement) {
3765
3730
  // `context` is document.body or element belonging to the document with the patch enabled
3766
- filtered = ArrayFilter.call(unfilteredNodes,
3767
- // TODO [#1222]: remove global bypass
3768
- function (elm) {
3731
+ filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
3769
3732
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
3770
3733
  });
3771
3734
  } else {
@@ -3794,13 +3757,11 @@
3794
3757
  querySelectorAll: {
3795
3758
  value: function value() {
3796
3759
  var nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
3797
- if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3798
- var filteredResults = getFilteredArrayOfNodes(this, nodeList, 0 /* ShadowDomSemantic.Disabled */);
3799
- return createStaticNodeList(filteredResults);
3800
- }
3801
- return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
3760
+ // Note: we deviate from native shadow here, but are not fixing
3761
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3762
+ var filteredResults = getFilteredArrayOfNodes(this, nodeList);
3763
+ return createStaticNodeList(filteredResults);
3802
3764
  },
3803
-
3804
3765
  writable: true,
3805
3766
  enumerable: true,
3806
3767
  configurable: true
@@ -3812,11 +3773,9 @@
3812
3773
  getElementsByClassName: {
3813
3774
  value: function value() {
3814
3775
  var elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
3815
- if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3816
- return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3817
- }
3818
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
3819
- return createStaticHTMLCollection(filteredResults);
3776
+ // Note: we deviate from native shadow here, but are not fixing
3777
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3778
+ return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3820
3779
  },
3821
3780
  writable: true,
3822
3781
  enumerable: true,
@@ -3825,11 +3784,9 @@
3825
3784
  getElementsByTagName: {
3826
3785
  value: function value() {
3827
3786
  var elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
3828
- if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3829
- return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3830
- }
3831
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
3832
- return createStaticHTMLCollection(filteredResults);
3787
+ // Note: we deviate from native shadow here, but are not fixing
3788
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3789
+ return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3833
3790
  },
3834
3791
  writable: true,
3835
3792
  enumerable: true,
@@ -3838,11 +3795,9 @@
3838
3795
  getElementsByTagNameNS: {
3839
3796
  value: function value() {
3840
3797
  var elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
3841
- if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3842
- return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3843
- }
3844
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
3845
- return createStaticHTMLCollection(filteredResults);
3798
+ // Note: we deviate from native shadow here, but are not fixing
3799
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3800
+ return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3846
3801
  },
3847
3802
  writable: true,
3848
3803
  enumerable: true,
@@ -3855,199 +3810,6 @@
3855
3810
  defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
3856
3811
  }
3857
3812
 
3858
- /*
3859
- * Copyright (c) 2018, salesforce.com, inc.
3860
- * All rights reserved.
3861
- * SPDX-License-Identifier: MIT
3862
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3863
- */
3864
- function getElementComputedStyle(element) {
3865
- var win = getOwnerWindow(element);
3866
- return windowGetComputedStyle.call(win, element);
3867
- }
3868
- function getWindowSelection(node) {
3869
- var win = getOwnerWindow(node);
3870
- return windowGetSelection.call(win);
3871
- }
3872
- function nodeIsBeingRendered(nodeComputedStyle) {
3873
- return nodeComputedStyle.visibility === 'visible' && nodeComputedStyle.display !== 'none';
3874
- }
3875
- function getSelectionState(element) {
3876
- var win = getOwnerWindow(element);
3877
- var selection = getWindowSelection(element);
3878
- if (selection === null) {
3879
- return null;
3880
- }
3881
- var ranges = [];
3882
- for (var i = 0; i < selection.rangeCount; i++) {
3883
- ranges.push(selection.getRangeAt(i));
3884
- }
3885
- var state = {
3886
- element: element,
3887
- onselect: win.onselect,
3888
- onselectstart: win.onselectstart,
3889
- onselectionchange: win.onselectionchange,
3890
- ranges: ranges
3891
- };
3892
- win.onselect = null;
3893
- win.onselectstart = null;
3894
- win.onselectionchange = null;
3895
- return state;
3896
- }
3897
- function restoreSelectionState(state) {
3898
- if (state === null) {
3899
- return;
3900
- }
3901
- var element = state.element,
3902
- onselect = state.onselect,
3903
- onselectstart = state.onselectstart,
3904
- onselectionchange = state.onselectionchange,
3905
- ranges = state.ranges;
3906
- var win = getOwnerWindow(element);
3907
- var selection = getWindowSelection(element);
3908
- selection.removeAllRanges();
3909
- for (var i = 0; i < ranges.length; i++) {
3910
- selection.addRange(ranges[i]);
3911
- }
3912
- win.onselect = onselect;
3913
- win.onselectstart = onselectstart;
3914
- win.onselectionchange = onselectionchange;
3915
- }
3916
- /**
3917
- * Gets the "innerText" of a text node using the Selection API
3918
- *
3919
- * NOTE: For performance reasons, since this function will be called multiple times while calculating the innerText of
3920
- * an element, it does not restore the current selection.
3921
- */
3922
- function getTextNodeInnerText(textNode) {
3923
- var selection = getWindowSelection(textNode);
3924
- if (selection === null) {
3925
- return textNode.textContent || '';
3926
- }
3927
- var range = document.createRange();
3928
- range.selectNodeContents(textNode);
3929
- var domRect = range.getBoundingClientRect();
3930
- if (domRect.height <= 0 || domRect.width <= 0) {
3931
- // the text node is not rendered
3932
- return '';
3933
- }
3934
- // Needed to remove non rendered characters from the text node.
3935
- selection.removeAllRanges();
3936
- selection.addRange(range);
3937
- var selectionText = selection.toString();
3938
- // The textNode is visible, but it may not be selectable. When the text is not selectable,
3939
- // textContent is the nearest approximation to innerText.
3940
- return selectionText ? selectionText : textNode.textContent || '';
3941
- }
3942
- var nodeIsElement = function nodeIsElement(node) {
3943
- return node.nodeType === ELEMENT_NODE;
3944
- };
3945
- var nodeIsText = function nodeIsText(node) {
3946
- return node.nodeType === TEXT_NODE;
3947
- };
3948
- /**
3949
- * Spec: https://html.spec.whatwg.org/multipage/dom.html#inner-text-collection-steps
3950
- * One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1132
3951
- */
3952
- function innerTextCollectionSteps(node) {
3953
- var items = [];
3954
- if (nodeIsElement(node)) {
3955
- var tagName = node.tagName;
3956
- var computedStyle = getElementComputedStyle(node);
3957
- if (tagName === 'OPTION') {
3958
- // For options, is hard to get the "rendered" text, let's use the original getter.
3959
- return [1, innerTextGetter.call(node), 1];
3960
- } else if (tagName === 'TEXTAREA') {
3961
- return [];
3962
- } else {
3963
- var childNodes = node.childNodes;
3964
- for (var i = 0, n = childNodes.length; i < n; i++) {
3965
- ArrayPush.apply(items, innerTextCollectionSteps(childNodes[i]));
3966
- }
3967
- }
3968
- if (!nodeIsBeingRendered(computedStyle)) {
3969
- if (tagName === 'SELECT' || tagName === 'DATALIST') {
3970
- // the select is either: .visibility != 'visible' or .display === hidden, therefore this select should
3971
- // not display any value.
3972
- return [];
3973
- }
3974
- return items;
3975
- }
3976
- if (tagName === 'BR') {
3977
- items.push("\n" /* line feed */);
3978
- }
3979
-
3980
- var display = computedStyle.display;
3981
- if (display === 'table-cell') {
3982
- // omitting case: and node's CSS box is not the last 'table-cell' box of its enclosing 'table-row' box
3983
- items.push("\t" /* tab */);
3984
- }
3985
-
3986
- if (display === 'table-row') {
3987
- // omitting case: and node's CSS box is not the last 'table-row' box of the nearest ancestor 'table' box
3988
- items.push("\n" /* line feed */);
3989
- }
3990
-
3991
- if (tagName === 'P') {
3992
- items.unshift(2);
3993
- items.push(2);
3994
- }
3995
- if (display === 'block' || display === 'table-caption' || display === 'flex' || display === 'table') {
3996
- items.unshift(1);
3997
- items.push(1);
3998
- }
3999
- } else if (nodeIsText(node)) {
4000
- items.push(getTextNodeInnerText(node));
4001
- }
4002
- return items;
4003
- }
4004
- /**
4005
- * InnerText getter spec: https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
4006
- *
4007
- * One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1087
4008
- */
4009
- function getInnerText(element) {
4010
- var thisComputedStyle = getElementComputedStyle(element);
4011
- if (!nodeIsBeingRendered(thisComputedStyle)) {
4012
- return getTextContent(element) || '';
4013
- }
4014
- var selectionState = getSelectionState(element);
4015
- var results = [];
4016
- var childNodes = element.childNodes;
4017
- for (var i = 0, n = childNodes.length; i < n; i++) {
4018
- ArrayPush.apply(results, innerTextCollectionSteps(childNodes[i]));
4019
- }
4020
- restoreSelectionState(selectionState);
4021
- var elementInnerText = '';
4022
- var maxReqLineBreakCount = 0;
4023
- for (var _i = 0, _n = results.length; _i < _n; _i++) {
4024
- var item = results[_i];
4025
- if (typeof item === 'string') {
4026
- if (maxReqLineBreakCount > 0) {
4027
- for (var j = 0; j < maxReqLineBreakCount; j++) {
4028
- elementInnerText += "\n";
4029
- }
4030
- maxReqLineBreakCount = 0;
4031
- }
4032
- if (item.length > 0) {
4033
- elementInnerText += item;
4034
- }
4035
- } else {
4036
- if (elementInnerText.length == 0) {
4037
- // Remove required line break count at the start.
4038
- continue;
4039
- }
4040
- // Store the count if it's the max of this run,
4041
- // but it may be ignored if no text item is found afterwards,
4042
- // which means that these are consecutive line breaks at the end.
4043
- if (item > maxReqLineBreakCount) {
4044
- maxReqLineBreakCount = item;
4045
- }
4046
- }
4047
- }
4048
- return elementInnerText;
4049
- }
4050
-
4051
3813
  /*
4052
3814
  * Copyright (c) 2018, salesforce.com, inc.
4053
3815
  * All rights reserved.
@@ -4517,20 +4279,9 @@
4517
4279
  if (innerTextGetter !== null && innerTextSetter !== null) {
4518
4280
  defineProperty(HTMLElement.prototype, 'innerText', {
4519
4281
  get: function get() {
4520
- if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4521
- return innerTextGetter.call(this);
4522
- }
4523
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4524
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4525
- return getInnerText(this);
4526
- }
4527
- return innerTextGetter.call(this);
4528
- }
4529
- // TODO [#1222]: remove global bypass
4530
- if (isGlobalPatchingSkipped(this)) {
4531
- return innerTextGetter.call(this);
4532
- }
4533
- return getInnerText(this);
4282
+ // Note: we deviate from native shadow here, but are not fixing
4283
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
4284
+ return innerTextGetter.call(this);
4534
4285
  },
4535
4286
  set: function set(v) {
4536
4287
  innerTextSetter.call(this, v);
@@ -4546,20 +4297,9 @@
4546
4297
  // As a setter, it removes the current node and replaces it with the given text.
4547
4298
  defineProperty(HTMLElement.prototype, 'outerText', {
4548
4299
  get: function get() {
4549
- if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4550
- return outerTextGetter.call(this);
4551
- }
4552
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4553
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4554
- return getInnerText(this);
4555
- }
4556
- return outerTextGetter.call(this);
4557
- }
4558
- // TODO [#1222]: remove global bypass
4559
- if (isGlobalPatchingSkipped(this)) {
4560
- return outerTextGetter.call(this);
4561
- }
4562
- return getInnerText(this);
4300
+ // Note: we deviate from native shadow here, but are not fixing
4301
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
4302
+ return outerTextGetter.call(this);
4563
4303
  },
4564
4304
  set: function set(v) {
4565
4305
  // Invoking the `outerText` setter on a host element should trigger its disconnection, but until we merge node reactions, it will not work.
@@ -4698,8 +4438,8 @@
4698
4438
  adoptChildNode(node, DocumentResolverFn, undefined);
4699
4439
  }
4700
4440
  }
4701
- for (var _i2 = 0, _len = addedNodes.length; _i2 < _len; _i2 += 1) {
4702
- var _node = addedNodes[_i2];
4441
+ for (var _i = 0, _len = addedNodes.length; _i < _len; _i += 1) {
4442
+ var _node = addedNodes[_i];
4703
4443
  if (compareDocumentPosition.call(elm, _node) & _Node.DOCUMENT_POSITION_CONTAINED_BY) {
4704
4444
  adoptChildNode(_node, fn, shadowToken);
4705
4445
  }
@@ -4748,6 +4488,6 @@
4748
4488
  },
4749
4489
  configurable: true
4750
4490
  });
4751
- /** version: 2.31.1 */
4491
+ /** version: 2.32.1 */
4752
4492
 
4753
4493
  })();