lwc 2.32.0 → 2.33.0

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 (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +898 -802
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +898 -802
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +683 -608
  5. package/dist/engine-dom/iife/es5/engine-dom.js +324 -313
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +234 -270
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +898 -802
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +683 -608
  11. package/dist/engine-dom/umd/es5/engine-dom.js +324 -313
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +234 -270
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +871 -696
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +871 -696
  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 +89 -347
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +89 -347
  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 +89 -347
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +89 -347
  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 +5 -3
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +5 -3
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +5 -3
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +5 -3
  41. package/package.json +7 -7
@@ -4,9 +4,11 @@
4
4
  })((function () { 'use strict';
5
5
 
6
6
  var _create, _create2;
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
12
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
13
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12
14
  /* proxy-compat-disable */
@@ -176,7 +178,7 @@
176
178
  var hasNativeSymbolSupport = /*@__PURE__*/function () {
177
179
  return Symbol('x').toString() === 'Symbol(x)';
178
180
  }();
179
- /** version: 2.32.0 */
181
+ /** version: 2.33.0 */
180
182
 
181
183
  /*
182
184
  * Copyright (c) 2018, salesforce.com, inc.
@@ -340,9 +342,7 @@
340
342
  */
341
343
  var _window = window,
342
344
  windowAddEventListener = _window.addEventListener,
343
- windowRemoveEventListener = _window.removeEventListener,
344
- windowGetComputedStyle = _window.getComputedStyle,
345
- windowGetSelection = _window.getSelection;
345
+ windowRemoveEventListener = _window.removeEventListener;
346
346
 
347
347
  /*
348
348
  * Copyright (c) 2018, salesforce.com, inc.
@@ -452,7 +452,8 @@
452
452
  return win;
453
453
  }
454
454
  var skipGlobalPatching;
455
- // TODO [#1222]: remove global bypass
455
+ // Note: we deviate from native shadow here, but are not fixing
456
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
456
457
  function isGlobalPatchingSkipped(node) {
457
458
  // we lazily compute this value instead of doing it during evaluation, this helps
458
459
  // for apps that are setting this after the engine code is evaluated.
@@ -493,7 +494,7 @@
493
494
  });
494
495
  }
495
496
  var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
496
- /** version: 2.32.0 */
497
+ /** version: 2.33.0 */
497
498
 
498
499
  /*
499
500
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1356,17 +1357,12 @@
1356
1357
  },
1357
1358
  textContent: {
1358
1359
  get: function get() {
1359
- if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1360
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1361
- return textContentGetterPatched.call(this);
1362
- }
1363
- return textContentGetter.call(this);
1364
- }
1365
- // TODO [#1222]: remove global bypass
1366
- if (isGlobalPatchingSkipped(this)) {
1367
- return textContentGetter.call(this);
1360
+ // Note: we deviate from native shadow here, but are not fixing
1361
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1362
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1363
+ return textContentGetterPatched.call(this);
1368
1364
  }
1369
- return textContentGetterPatched.call(this);
1365
+ return textContentGetter.call(this);
1370
1366
  },
1371
1367
  set: textContentSetterPatched,
1372
1368
  enumerable: true,
@@ -1427,7 +1423,8 @@
1427
1423
  },
1428
1424
  compareDocumentPosition: {
1429
1425
  value: function value(otherNode) {
1430
- // TODO [#1222]: remove global bypass
1426
+ // Note: we deviate from native shadow here, but are not fixing
1427
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1431
1428
  if (isGlobalPatchingSkipped(this)) {
1432
1429
  return compareDocumentPosition.call(this, otherNode);
1433
1430
  }
@@ -1446,20 +1443,15 @@
1446
1443
  if (this === otherNode) {
1447
1444
  return true;
1448
1445
  }
1449
- if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1450
- if (otherNode == null) {
1451
- return false;
1452
- }
1453
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1454
- return containsPatched.call(this, otherNode);
1455
- }
1456
- return contains.call(this, otherNode);
1446
+ // Note: we deviate from native shadow here, but are not fixing
1447
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1448
+ if (otherNode == null) {
1449
+ return false;
1457
1450
  }
1458
- // TODO [#1222]: remove global bypass
1459
- if (isGlobalPatchingSkipped(this)) {
1460
- return contains.call(this, otherNode);
1451
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1452
+ return containsPatched.call(this, otherNode);
1461
1453
  }
1462
- return containsPatched.call(this, otherNode);
1454
+ return contains.call(this, otherNode);
1463
1455
  },
1464
1456
  enumerable: true,
1465
1457
  writable: true,
@@ -1467,17 +1459,9 @@
1467
1459
  },
1468
1460
  cloneNode: {
1469
1461
  value: function value(deep) {
1470
- if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1471
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1472
- return cloneNodePatched.call(this, deep);
1473
- }
1474
- return cloneNode.call(this, deep);
1475
- }
1476
- if (isTrue(deep)) {
1477
- // TODO [#1222]: remove global bypass
1478
- if (isGlobalPatchingSkipped(this)) {
1479
- return cloneNode.call(this, deep);
1480
- }
1462
+ // Note: we deviate from native shadow here, but are not fixing
1463
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
1464
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1481
1465
  return cloneNodePatched.call(this, deep);
1482
1466
  }
1483
1467
  return cloneNode.call(this, deep);
@@ -2491,7 +2475,8 @@
2491
2475
  if (isNull(elm)) {
2492
2476
  return null;
2493
2477
  }
2494
- // TODO [#1222]: remove global bypass
2478
+ // Note: we deviate from native shadow here, but are not fixing
2479
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2495
2480
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm) ? elm : null;
2496
2481
  },
2497
2482
  writable: true,
@@ -2502,7 +2487,8 @@
2502
2487
  value: function value() {
2503
2488
  var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
2504
2489
  var filtered = ArrayFind.call(elements,
2505
- // TODO [#1222]: remove global bypass
2490
+ // Note: we deviate from native shadow here, but are not fixing
2491
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2506
2492
  function (elm) {
2507
2493
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2508
2494
  });
@@ -2516,7 +2502,8 @@
2516
2502
  value: function value() {
2517
2503
  var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
2518
2504
  var filtered = ArrayFilter.call(elements,
2519
- // TODO [#1222]: remove global bypass
2505
+ // Note: we deviate from native shadow here, but are not fixing
2506
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2520
2507
  function (elm) {
2521
2508
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2522
2509
  });
@@ -2530,7 +2517,8 @@
2530
2517
  value: function value() {
2531
2518
  var elements = arrayFromCollection(getElementsByClassName.apply(this, ArraySlice.call(arguments)));
2532
2519
  var filtered = ArrayFilter.call(elements,
2533
- // TODO [#1222]: remove global bypass
2520
+ // Note: we deviate from native shadow here, but are not fixing
2521
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2534
2522
  function (elm) {
2535
2523
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2536
2524
  });
@@ -2544,7 +2532,8 @@
2544
2532
  value: function value() {
2545
2533
  var elements = arrayFromCollection(getElementsByTagName.apply(this, ArraySlice.call(arguments)));
2546
2534
  var filtered = ArrayFilter.call(elements,
2547
- // TODO [#1222]: remove global bypass
2535
+ // Note: we deviate from native shadow here, but are not fixing
2536
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2548
2537
  function (elm) {
2549
2538
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2550
2539
  });
@@ -2558,7 +2547,8 @@
2558
2547
  value: function value() {
2559
2548
  var elements = arrayFromCollection(getElementsByTagNameNS.apply(this, ArraySlice.call(arguments)));
2560
2549
  var filtered = ArrayFilter.call(elements,
2561
- // TODO [#1222]: remove global bypass
2550
+ // Note: we deviate from native shadow here, but are not fixing
2551
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2562
2552
  function (elm) {
2563
2553
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2564
2554
  });
@@ -2574,7 +2564,8 @@
2574
2564
  value: function value() {
2575
2565
  var elements = arrayFromCollection(getElementsByName.apply(this, ArraySlice.call(arguments)));
2576
2566
  var filtered = ArrayFilter.call(elements,
2577
- // TODO [#1222]: remove global bypass
2567
+ // Note: we deviate from native shadow here, but are not fixing
2568
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
2578
2569
  function (elm) {
2579
2570
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2580
2571
  });
@@ -3672,7 +3663,8 @@
3672
3663
  } else if (context instanceof HTMLBodyElement) {
3673
3664
  // `context` is document.body which is already patched.
3674
3665
  filtered = ArrayFilter.call(unfilteredNodes,
3675
- // TODO [#1222]: remove global bypass
3666
+ // Note: we deviate from native shadow here, but are not fixing
3667
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3676
3668
  function (elm) {
3677
3669
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
3678
3670
  });
@@ -3738,17 +3730,12 @@
3738
3730
  defineProperties(Element.prototype, {
3739
3731
  innerHTML: {
3740
3732
  get: function get() {
3741
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
3742
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3743
- return innerHTMLGetterPatched.call(this);
3744
- }
3745
- return innerHTMLGetter.call(this);
3733
+ // Note: we deviate from native shadow here, but are not fixing
3734
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3735
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3736
+ return innerHTMLGetterPatched.call(this);
3746
3737
  }
3747
- // TODO [#1222]: remove global bypass
3748
- if (isGlobalPatchingSkipped(this)) {
3749
- return innerHTMLGetter.call(this);
3750
- }
3751
- return innerHTMLGetterPatched.call(this);
3738
+ return innerHTMLGetter.call(this);
3752
3739
  },
3753
3740
  set: function set(v) {
3754
3741
  innerHTMLSetter.call(this, v);
@@ -3758,17 +3745,12 @@
3758
3745
  },
3759
3746
  outerHTML: {
3760
3747
  get: function get() {
3761
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
3762
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3763
- return outerHTMLGetterPatched.call(this);
3764
- }
3765
- return outerHTMLGetter.call(this);
3766
- }
3767
- // TODO [#1222]: remove global bypass
3768
- if (isGlobalPatchingSkipped(this)) {
3769
- return outerHTMLGetter.call(this);
3748
+ // Note: we deviate from native shadow here, but are not fixing
3749
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3750
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3751
+ return outerHTMLGetterPatched.call(this);
3770
3752
  }
3771
- return outerHTMLGetterPatched.call(this);
3753
+ return outerHTMLGetter.call(this);
3772
3754
  },
3773
3755
  set: function set(v) {
3774
3756
  outerHTMLSetter.call(this, v);
@@ -3870,35 +3852,24 @@
3870
3852
  });
3871
3853
  return isUndefined(elm) ? null : elm;
3872
3854
  } else {
3873
- if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3874
- // `this` is a manually inserted element inside a shadowRoot, return the first element.
3875
- return nodeList.length === 0 ? null : nodeList[0];
3876
- }
3877
- // Element is inside a shadow but we dont know which one. Use the
3878
- // "nearest" owner key to filter by ownership.
3879
- var contextNearestOwnerKey = getNodeNearestOwnerKey(this);
3880
- var _elm = ArrayFind.call(nodeList, function (elm) {
3881
- return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
3882
- });
3883
- return isUndefined(_elm) ? null : _elm;
3855
+ // Note: we deviate from native shadow here, but are not fixing
3856
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3857
+ // `this` is a manually inserted element inside a shadowRoot, return the first element.
3858
+ return nodeList.length === 0 ? null : nodeList[0];
3884
3859
  }
3885
3860
  } else {
3886
- if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3887
- if (!(this instanceof HTMLBodyElement)) {
3888
- var _elm3 = nodeList[0];
3889
- return isUndefined(_elm3) ? null : _elm3;
3890
- }
3861
+ if (!(this instanceof HTMLBodyElement)) {
3862
+ var _elm2 = nodeList[0];
3863
+ return isUndefined(_elm2) ? null : _elm2;
3891
3864
  }
3892
3865
  // element belonging to the document
3893
- var _elm2 = ArrayFind.call(nodeList,
3894
- // TODO [#1222]: remove global bypass
3895
- function (elm) {
3866
+ var _elm = ArrayFind.call(nodeList, function (elm) {
3896
3867
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(_this3);
3897
3868
  });
3898
- return isUndefined(_elm2) ? null : _elm2;
3869
+ return isUndefined(_elm) ? null : _elm;
3899
3870
  }
3900
3871
  }
3901
- function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
3872
+ function getFilteredArrayOfNodes(context, unfilteredNodes) {
3902
3873
  var filtered;
3903
3874
  if (isSyntheticShadowHost(context)) {
3904
3875
  // element with shadowRoot attached
@@ -3920,22 +3891,16 @@
3920
3891
  filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
3921
3892
  return getNodeNearestOwnerKey(elm) === ownerKey;
3922
3893
  });
3923
- } else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
3924
- // context is inside a shadow, we dont know which one.
3925
- var contextNearestOwnerKey = getNodeNearestOwnerKey(context);
3926
- filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
3927
- return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
3928
- });
3929
3894
  } else {
3930
- // context is manually inserted without lwc:dom-manual and ShadowDomSemantics is off, return everything
3895
+ // Note: we deviate from native shadow here, but are not fixing
3896
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3897
+ // context is manually inserted without lwc:dom-manual, return everything
3931
3898
  filtered = ArraySlice.call(unfilteredNodes);
3932
3899
  }
3933
3900
  } else {
3934
- if (context instanceof HTMLBodyElement || shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
3901
+ if (context instanceof HTMLBodyElement) {
3935
3902
  // `context` is document.body or element belonging to the document with the patch enabled
3936
- filtered = ArrayFilter.call(unfilteredNodes,
3937
- // TODO [#1222]: remove global bypass
3938
- function (elm) {
3903
+ filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
3939
3904
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
3940
3905
  });
3941
3906
  } else {
@@ -3964,13 +3929,11 @@
3964
3929
  querySelectorAll: {
3965
3930
  value: function value() {
3966
3931
  var nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
3967
- if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3968
- var filteredResults = getFilteredArrayOfNodes(this, nodeList, 0 /* ShadowDomSemantic.Disabled */);
3969
- return createStaticNodeList(filteredResults);
3970
- }
3971
- return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
3932
+ // Note: we deviate from native shadow here, but are not fixing
3933
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3934
+ var filteredResults = getFilteredArrayOfNodes(this, nodeList);
3935
+ return createStaticNodeList(filteredResults);
3972
3936
  },
3973
-
3974
3937
  writable: true,
3975
3938
  enumerable: true,
3976
3939
  configurable: true
@@ -3982,11 +3945,9 @@
3982
3945
  getElementsByClassName: {
3983
3946
  value: function value() {
3984
3947
  var elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
3985
- if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3986
- return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3987
- }
3988
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
3989
- return createStaticHTMLCollection(filteredResults);
3948
+ // Note: we deviate from native shadow here, but are not fixing
3949
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3950
+ return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3990
3951
  },
3991
3952
  writable: true,
3992
3953
  enumerable: true,
@@ -3995,11 +3956,9 @@
3995
3956
  getElementsByTagName: {
3996
3957
  value: function value() {
3997
3958
  var elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
3998
- if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3999
- return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4000
- }
4001
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4002
- return createStaticHTMLCollection(filteredResults);
3959
+ // Note: we deviate from native shadow here, but are not fixing
3960
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3961
+ return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4003
3962
  },
4004
3963
  writable: true,
4005
3964
  enumerable: true,
@@ -4008,11 +3967,9 @@
4008
3967
  getElementsByTagNameNS: {
4009
3968
  value: function value() {
4010
3969
  var elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
4011
- if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4012
- return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4013
- }
4014
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4015
- return createStaticHTMLCollection(filteredResults);
3970
+ // Note: we deviate from native shadow here, but are not fixing
3971
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
3972
+ return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4016
3973
  },
4017
3974
  writable: true,
4018
3975
  enumerable: true,
@@ -4025,199 +3982,6 @@
4025
3982
  defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
4026
3983
  }
4027
3984
 
4028
- /*
4029
- * Copyright (c) 2018, salesforce.com, inc.
4030
- * All rights reserved.
4031
- * SPDX-License-Identifier: MIT
4032
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4033
- */
4034
- function getElementComputedStyle(element) {
4035
- var win = getOwnerWindow(element);
4036
- return windowGetComputedStyle.call(win, element);
4037
- }
4038
- function getWindowSelection(node) {
4039
- var win = getOwnerWindow(node);
4040
- return windowGetSelection.call(win);
4041
- }
4042
- function nodeIsBeingRendered(nodeComputedStyle) {
4043
- return nodeComputedStyle.visibility === 'visible' && nodeComputedStyle.display !== 'none';
4044
- }
4045
- function getSelectionState(element) {
4046
- var win = getOwnerWindow(element);
4047
- var selection = getWindowSelection(element);
4048
- if (selection === null) {
4049
- return null;
4050
- }
4051
- var ranges = [];
4052
- for (var i = 0; i < selection.rangeCount; i++) {
4053
- ranges.push(selection.getRangeAt(i));
4054
- }
4055
- var state = {
4056
- element: element,
4057
- onselect: win.onselect,
4058
- onselectstart: win.onselectstart,
4059
- onselectionchange: win.onselectionchange,
4060
- ranges: ranges
4061
- };
4062
- win.onselect = null;
4063
- win.onselectstart = null;
4064
- win.onselectionchange = null;
4065
- return state;
4066
- }
4067
- function restoreSelectionState(state) {
4068
- if (state === null) {
4069
- return;
4070
- }
4071
- var element = state.element,
4072
- onselect = state.onselect,
4073
- onselectstart = state.onselectstart,
4074
- onselectionchange = state.onselectionchange,
4075
- ranges = state.ranges;
4076
- var win = getOwnerWindow(element);
4077
- var selection = getWindowSelection(element);
4078
- selection.removeAllRanges();
4079
- for (var i = 0; i < ranges.length; i++) {
4080
- selection.addRange(ranges[i]);
4081
- }
4082
- win.onselect = onselect;
4083
- win.onselectstart = onselectstart;
4084
- win.onselectionchange = onselectionchange;
4085
- }
4086
- /**
4087
- * Gets the "innerText" of a text node using the Selection API
4088
- *
4089
- * NOTE: For performance reasons, since this function will be called multiple times while calculating the innerText of
4090
- * an element, it does not restore the current selection.
4091
- */
4092
- function getTextNodeInnerText(textNode) {
4093
- var selection = getWindowSelection(textNode);
4094
- if (selection === null) {
4095
- return textNode.textContent || '';
4096
- }
4097
- var range = document.createRange();
4098
- range.selectNodeContents(textNode);
4099
- var domRect = range.getBoundingClientRect();
4100
- if (domRect.height <= 0 || domRect.width <= 0) {
4101
- // the text node is not rendered
4102
- return '';
4103
- }
4104
- // Needed to remove non rendered characters from the text node.
4105
- selection.removeAllRanges();
4106
- selection.addRange(range);
4107
- var selectionText = selection.toString();
4108
- // The textNode is visible, but it may not be selectable. When the text is not selectable,
4109
- // textContent is the nearest approximation to innerText.
4110
- return selectionText ? selectionText : textNode.textContent || '';
4111
- }
4112
- var nodeIsElement = function nodeIsElement(node) {
4113
- return node.nodeType === ELEMENT_NODE;
4114
- };
4115
- var nodeIsText = function nodeIsText(node) {
4116
- return node.nodeType === TEXT_NODE;
4117
- };
4118
- /**
4119
- * Spec: https://html.spec.whatwg.org/multipage/dom.html#inner-text-collection-steps
4120
- * One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1132
4121
- */
4122
- function innerTextCollectionSteps(node) {
4123
- var items = [];
4124
- if (nodeIsElement(node)) {
4125
- var tagName = node.tagName;
4126
- var computedStyle = getElementComputedStyle(node);
4127
- if (tagName === 'OPTION') {
4128
- // For options, is hard to get the "rendered" text, let's use the original getter.
4129
- return [1, innerTextGetter.call(node), 1];
4130
- } else if (tagName === 'TEXTAREA') {
4131
- return [];
4132
- } else {
4133
- var childNodes = node.childNodes;
4134
- for (var i = 0, n = childNodes.length; i < n; i++) {
4135
- ArrayPush.apply(items, innerTextCollectionSteps(childNodes[i]));
4136
- }
4137
- }
4138
- if (!nodeIsBeingRendered(computedStyle)) {
4139
- if (tagName === 'SELECT' || tagName === 'DATALIST') {
4140
- // the select is either: .visibility != 'visible' or .display === hidden, therefore this select should
4141
- // not display any value.
4142
- return [];
4143
- }
4144
- return items;
4145
- }
4146
- if (tagName === 'BR') {
4147
- items.push("\n" /* line feed */);
4148
- }
4149
-
4150
- var display = computedStyle.display;
4151
- if (display === 'table-cell') {
4152
- // omitting case: and node's CSS box is not the last 'table-cell' box of its enclosing 'table-row' box
4153
- items.push("\t" /* tab */);
4154
- }
4155
-
4156
- if (display === 'table-row') {
4157
- // omitting case: and node's CSS box is not the last 'table-row' box of the nearest ancestor 'table' box
4158
- items.push("\n" /* line feed */);
4159
- }
4160
-
4161
- if (tagName === 'P') {
4162
- items.unshift(2);
4163
- items.push(2);
4164
- }
4165
- if (display === 'block' || display === 'table-caption' || display === 'flex' || display === 'table') {
4166
- items.unshift(1);
4167
- items.push(1);
4168
- }
4169
- } else if (nodeIsText(node)) {
4170
- items.push(getTextNodeInnerText(node));
4171
- }
4172
- return items;
4173
- }
4174
- /**
4175
- * InnerText getter spec: https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
4176
- *
4177
- * One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1087
4178
- */
4179
- function getInnerText(element) {
4180
- var thisComputedStyle = getElementComputedStyle(element);
4181
- if (!nodeIsBeingRendered(thisComputedStyle)) {
4182
- return getTextContent(element) || '';
4183
- }
4184
- var selectionState = getSelectionState(element);
4185
- var results = [];
4186
- var childNodes = element.childNodes;
4187
- for (var i = 0, n = childNodes.length; i < n; i++) {
4188
- ArrayPush.apply(results, innerTextCollectionSteps(childNodes[i]));
4189
- }
4190
- restoreSelectionState(selectionState);
4191
- var elementInnerText = '';
4192
- var maxReqLineBreakCount = 0;
4193
- for (var _i = 0, _n = results.length; _i < _n; _i++) {
4194
- var item = results[_i];
4195
- if (typeof item === 'string') {
4196
- if (maxReqLineBreakCount > 0) {
4197
- for (var j = 0; j < maxReqLineBreakCount; j++) {
4198
- elementInnerText += "\n";
4199
- }
4200
- maxReqLineBreakCount = 0;
4201
- }
4202
- if (item.length > 0) {
4203
- elementInnerText += item;
4204
- }
4205
- } else {
4206
- if (elementInnerText.length == 0) {
4207
- // Remove required line break count at the start.
4208
- continue;
4209
- }
4210
- // Store the count if it's the max of this run,
4211
- // but it may be ignored if no text item is found afterwards,
4212
- // which means that these are consecutive line breaks at the end.
4213
- if (item > maxReqLineBreakCount) {
4214
- maxReqLineBreakCount = item;
4215
- }
4216
- }
4217
- }
4218
- return elementInnerText;
4219
- }
4220
-
4221
3985
  /*
4222
3986
  * Copyright (c) 2018, salesforce.com, inc.
4223
3987
  * All rights reserved.
@@ -4696,20 +4460,9 @@
4696
4460
  if (innerTextGetter !== null && innerTextSetter !== null) {
4697
4461
  defineProperty(HTMLElement.prototype, 'innerText', {
4698
4462
  get: function get() {
4699
- if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4700
- return innerTextGetter.call(this);
4701
- }
4702
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4703
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4704
- return getInnerText(this);
4705
- }
4706
- return innerTextGetter.call(this);
4707
- }
4708
- // TODO [#1222]: remove global bypass
4709
- if (isGlobalPatchingSkipped(this)) {
4710
- return innerTextGetter.call(this);
4711
- }
4712
- return getInnerText(this);
4463
+ // Note: we deviate from native shadow here, but are not fixing
4464
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
4465
+ return innerTextGetter.call(this);
4713
4466
  },
4714
4467
  set: function set(v) {
4715
4468
  innerTextSetter.call(this, v);
@@ -4725,20 +4478,9 @@
4725
4478
  // As a setter, it removes the current node and replaces it with the given text.
4726
4479
  defineProperty(HTMLElement.prototype, 'outerText', {
4727
4480
  get: function get() {
4728
- if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4729
- return outerTextGetter.call(this);
4730
- }
4731
- if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4732
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4733
- return getInnerText(this);
4734
- }
4735
- return outerTextGetter.call(this);
4736
- }
4737
- // TODO [#1222]: remove global bypass
4738
- if (isGlobalPatchingSkipped(this)) {
4739
- return outerTextGetter.call(this);
4740
- }
4741
- return getInnerText(this);
4481
+ // Note: we deviate from native shadow here, but are not fixing
4482
+ // due to backwards compat: https://github.com/salesforce/lwc/pull/3103
4483
+ return outerTextGetter.call(this);
4742
4484
  },
4743
4485
  set: function set(v) {
4744
4486
  // Invoking the `outerText` setter on a host element should trigger its disconnection, but until we merge node reactions, it will not work.
@@ -4877,8 +4619,8 @@
4877
4619
  adoptChildNode(node, DocumentResolverFn, undefined);
4878
4620
  }
4879
4621
  }
4880
- for (var _i2 = 0, _len = addedNodes.length; _i2 < _len; _i2 += 1) {
4881
- var _node = addedNodes[_i2];
4622
+ for (var _i = 0, _len = addedNodes.length; _i < _len; _i += 1) {
4623
+ var _node = addedNodes[_i];
4882
4624
  if (compareDocumentPosition.call(elm, _node) & _Node.DOCUMENT_POSITION_CONTAINED_BY) {
4883
4625
  adoptChildNode(_node, fn, shadowToken);
4884
4626
  }
@@ -4950,6 +4692,6 @@
4950
4692
  }));
4951
4693
  });
4952
4694
  }
4953
- /** version: 2.32.0 */
4695
+ /** version: 2.33.0 */
4954
4696
 
4955
4697
  }));