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