lwc 2.29.0 → 2.30.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 (37) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +319 -683
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +319 -683
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +201 -624
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1138 -2843
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +892 -2428
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +319 -683
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +201 -624
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1138 -2843
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +892 -2428
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +204 -584
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +204 -584
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +99 -323
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +99 -323
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +98 -316
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +483 -1220
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +470 -1187
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +99 -323
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +98 -316
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +483 -1220
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +470 -1187
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
  29. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service.js +13 -68
  31. package/dist/wire-service/iife/es5/wire-service_debug.js +13 -68
  32. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  33. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  34. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es5/wire-service.js +13 -68
  36. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -68
  37. package/package.json +7 -7
@@ -153,7 +153,7 @@
153
153
  // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
154
154
  // we can't use typeof since it will fail when transpiling.
155
155
  const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
156
- /** version: 2.29.0 */
156
+ /** version: 2.30.0 */
157
157
 
158
158
  /*
159
159
  * Copyright (c) 2018, salesforce.com, inc.
@@ -467,7 +467,7 @@
467
467
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
468
468
  }
469
469
  const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
470
- /** version: 2.29.0 */
470
+ /** version: 2.30.0 */
471
471
 
472
472
  /*
473
473
  * Copyright (c) 2018, salesforce.com, inc.
@@ -475,25 +475,22 @@
475
475
  * SPDX-License-Identifier: MIT
476
476
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
477
477
  */
478
-
478
+ // Used as a back reference to identify the host element
479
479
  const HostElementKey = '$$HostElementKey$$';
480
480
  const ShadowedNodeKey = '$$ShadowedNodeKey$$';
481
-
482
481
  function fastDefineProperty(node, propName, config) {
483
482
  const shadowedNode = node;
484
-
485
483
  if (process.env.NODE_ENV !== 'production') {
486
484
  // in dev, we are more restrictive
487
485
  defineProperty(shadowedNode, propName, config);
488
486
  } else {
489
487
  const {
490
488
  value
491
- } = config; // in prod, we prioritize performance
492
-
489
+ } = config;
490
+ // in prod, we prioritize performance
493
491
  shadowedNode[propName] = value;
494
492
  }
495
493
  }
496
-
497
494
  function setNodeOwnerKey(node, value) {
498
495
  fastDefineProperty(node, HostElementKey, {
499
496
  value,
@@ -510,18 +507,15 @@
510
507
  }
511
508
  function getNodeNearestOwnerKey(node) {
512
509
  let host = node;
513
- let hostKey; // search for the first element with owner identity
510
+ let hostKey;
511
+ // search for the first element with owner identity
514
512
  // in case of manually inserted elements and elements slotted from Light DOM
515
-
516
513
  while (!isNull(host)) {
517
514
  hostKey = getNodeOwnerKey(host);
518
-
519
515
  if (!isUndefined(hostKey)) {
520
516
  return hostKey;
521
517
  }
522
-
523
518
  host = parentNodeGetter.call(host);
524
-
525
519
  if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
526
520
  if (!isNull(host) && isSyntheticSlotElement(host)) {
527
521
  return undefined;
@@ -537,7 +531,6 @@
537
531
  * cases. If we need to traverse up and verify those nodes that don't have owner key, use
538
532
  * isNodeDeepShadowed instead.
539
533
  */
540
-
541
534
  function isNodeShadowed(node) {
542
535
  return !isUndefined(getNodeOwnerKey(node));
543
536
  }
@@ -548,35 +541,29 @@
548
541
  * SPDX-License-Identifier: MIT
549
542
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
550
543
  */
544
+ // when finding a slot in the DOM, we can fold it if it is contained
551
545
  // inside another slot.
552
-
553
546
  function foldSlotElement(slot) {
554
547
  let parent = parentElementGetter.call(slot);
555
-
556
548
  while (!isNull(parent) && isSlotElement(parent)) {
557
549
  slot = parent;
558
550
  parent = parentElementGetter.call(slot);
559
551
  }
560
-
561
552
  return slot;
562
553
  }
563
-
564
554
  function isNodeSlotted(host, node) {
565
555
  if (process.env.NODE_ENV !== 'production') {
566
556
  assert.invariant(host instanceof HTMLElement, `isNodeSlotted() should be called with a host as the first argument instead of ${host}`);
567
557
  assert.invariant(node instanceof _Node, `isNodeSlotted() should be called with a node as the second argument instead of ${node}`);
568
558
  assert.invariant(compareDocumentPosition.call(node, host) & DOCUMENT_POSITION_CONTAINS, `isNodeSlotted() should never be called with a node that is not a child node of ${host}`);
569
559
  }
570
-
571
- const hostKey = getNodeKey(host); // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
560
+ const hostKey = getNodeKey(host);
561
+ // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
572
562
  // just in case the provided node is not an element
573
-
574
563
  let currentElement = node instanceof Element ? node : parentElementGetter.call(node);
575
-
576
564
  while (!isNull(currentElement) && currentElement !== host) {
577
565
  const elmOwnerKey = getNodeNearestOwnerKey(currentElement);
578
566
  const parent = parentElementGetter.call(currentElement);
579
-
580
567
  if (elmOwnerKey === hostKey) {
581
568
  // we have reached an element inside the host's template, and only if
582
569
  // that element is an slot, then the node is considered slotted
@@ -602,7 +589,6 @@
602
589
  * most outer slot parent before jumping into its corresponding host.
603
590
  */
604
591
  currentElement = getNodeOwner(foldSlotElement(parent));
605
-
606
592
  if (!isNull(currentElement)) {
607
593
  if (currentElement === host) {
608
594
  // the slot element is a top level element inside the shadow
@@ -621,32 +607,25 @@
621
607
  currentElement = parent;
622
608
  }
623
609
  }
624
-
625
610
  return false;
626
611
  }
627
-
628
612
  function getNodeOwner(node) {
629
613
  if (!(node instanceof _Node)) {
630
614
  return null;
631
615
  }
632
-
633
616
  const ownerKey = getNodeNearestOwnerKey(node);
634
-
635
617
  if (isUndefined(ownerKey)) {
636
618
  return null;
637
619
  }
638
-
639
- let nodeOwner = node; // At this point, node is a valid node with owner identity, now we need to find the owner node
620
+ let nodeOwner = node;
621
+ // At this point, node is a valid node with owner identity, now we need to find the owner node
640
622
  // search for a custom element with a VM that owns the first element with owner identity attached to it
641
-
642
623
  while (!isNull(nodeOwner) && getNodeKey(nodeOwner) !== ownerKey) {
643
624
  nodeOwner = parentNodeGetter.call(nodeOwner);
644
625
  }
645
-
646
626
  if (isNull(nodeOwner)) {
647
627
  return null;
648
628
  }
649
-
650
629
  return nodeOwner;
651
630
  }
652
631
  function isSyntheticSlotElement(node) {
@@ -661,23 +640,18 @@
661
640
  assert.invariant(node instanceof _Node, `isNodeOwnedBy() should be called with a node as the second argument instead of ${node}`);
662
641
  assert.invariant(compareDocumentPosition.call(node, owner) & DOCUMENT_POSITION_CONTAINS, `isNodeOwnedBy() should never be called with a node that is not a child node of ${owner}`);
663
642
  }
664
-
665
643
  const ownerKey = getNodeNearestOwnerKey(node);
666
-
667
644
  if (isUndefined(ownerKey)) {
668
645
  if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
669
646
  // in case of root level light DOM element slotting into a synthetic shadow
670
647
  const host = parentNodeGetter.call(node);
671
-
672
648
  if (!isNull(host) && isSyntheticSlotElement(host)) {
673
649
  return false;
674
650
  }
675
- } // in case of manually inserted elements
676
-
677
-
651
+ }
652
+ // in case of manually inserted elements
678
653
  return true;
679
654
  }
680
-
681
655
  return getNodeKey(owner) === ownerKey;
682
656
  }
683
657
  function shadowRootChildNodes(root) {
@@ -686,42 +660,34 @@
686
660
  }
687
661
  function getAllSlottedMatches(host, nodeList) {
688
662
  const filteredAndPatched = [];
689
-
690
663
  for (let i = 0, len = nodeList.length; i < len; i += 1) {
691
664
  const node = nodeList[i];
692
-
693
665
  if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
694
666
  ArrayPush.call(filteredAndPatched, node);
695
667
  }
696
668
  }
697
-
698
669
  return filteredAndPatched;
699
670
  }
700
671
  function getFirstSlottedMatch(host, nodeList) {
701
672
  for (let i = 0, len = nodeList.length; i < len; i += 1) {
702
673
  const node = nodeList[i];
703
-
704
674
  if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
705
675
  return node;
706
676
  }
707
677
  }
708
-
709
678
  return null;
710
679
  }
711
680
  function getAllMatches(owner, nodeList) {
712
681
  const filteredAndPatched = [];
713
-
714
682
  for (let i = 0, len = nodeList.length; i < len; i += 1) {
715
683
  const node = nodeList[i];
716
684
  const isOwned = isNodeOwnedBy(owner, node);
717
-
718
685
  if (isOwned) {
719
686
  // Patch querySelector, querySelectorAll, etc
720
687
  // if element is owned by VM
721
688
  ArrayPush.call(filteredAndPatched, node);
722
689
  }
723
690
  }
724
-
725
691
  return filteredAndPatched;
726
692
  }
727
693
  function getFirstMatch(owner, nodeList) {
@@ -730,7 +696,6 @@
730
696
  return nodeList[i];
731
697
  }
732
698
  }
733
-
734
699
  return null;
735
700
  }
736
701
  function shadowRootQuerySelector(root, selector) {
@@ -749,19 +714,17 @@
749
714
  const children = childNodesGetter.call(node);
750
715
  return arrayFromCollection(children);
751
716
  }
752
-
753
717
  if (isSyntheticShadowHost(node)) {
754
718
  // we need to get only the nodes that were slotted
755
719
  const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
756
- const resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
720
+ const resolver = getShadowRootResolver(getShadowRoot(node));
721
+ // Typescript is inferring the wrong function type for this particular
757
722
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
758
723
  // @ts-ignore type-mismatch
759
-
760
724
  return ArrayReduce.call(slots, (seed, slot) => {
761
725
  if (resolver === getShadowRootResolver(slot)) {
762
726
  ArrayPush.apply(seed, getFilteredSlotAssignedNodes(slot));
763
727
  }
764
-
765
728
  return seed;
766
729
  }, []);
767
730
  } else {
@@ -773,11 +736,9 @@
773
736
  }
774
737
  function getFilteredSlotAssignedNodes(slot) {
775
738
  const owner = getNodeOwner(slot);
776
-
777
739
  if (isNull(owner)) {
778
740
  return [];
779
741
  }
780
-
781
742
  const childNodes = arrayFromCollection(childNodesGetter.call(slot));
782
743
  return ArrayFilter.call(childNodes, child => !isNodeShadowed(child) || !isNodeOwnedBy(owner, child));
783
744
  }
@@ -1199,14 +1160,11 @@
1199
1160
  * and elements with shadow dom attached to them. It doesn't apply to native slot elements
1200
1161
  * because we don't want to patch the children getters for those elements.
1201
1162
  */
1202
-
1203
1163
  function hasMountedChildren(node) {
1204
1164
  return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
1205
1165
  }
1206
-
1207
1166
  function getShadowParent(node, value) {
1208
1167
  const owner = getNodeOwner(node);
1209
-
1210
1168
  if (value === owner) {
1211
1169
  // walking up via parent chain might end up in the shadow root element
1212
1170
  return getShadowRoot(owner);
@@ -1219,64 +1177,50 @@
1219
1177
  // where they slotted into, but its shadowed parent is always the
1220
1178
  // owner of the slot.
1221
1179
  const slotOwner = getNodeOwner(value);
1222
-
1223
1180
  if (!isNull(slotOwner) && isNodeOwnedBy(owner, slotOwner)) {
1224
1181
  // it is a slotted element, and therefore its parent is always going to be the host of the slot
1225
1182
  return slotOwner;
1226
1183
  }
1227
1184
  }
1228
1185
  }
1229
-
1230
1186
  return null;
1231
1187
  }
1232
-
1233
1188
  function hasChildNodesPatched() {
1234
1189
  return getInternalChildNodes(this).length > 0;
1235
1190
  }
1236
-
1237
1191
  function firstChildGetterPatched() {
1238
1192
  const childNodes = getInternalChildNodes(this);
1239
1193
  return childNodes[0] || null;
1240
1194
  }
1241
-
1242
1195
  function lastChildGetterPatched() {
1243
1196
  const childNodes = getInternalChildNodes(this);
1244
1197
  return childNodes[childNodes.length - 1] || null;
1245
1198
  }
1246
-
1247
1199
  function textContentGetterPatched() {
1248
1200
  return getTextContent(this);
1249
1201
  }
1250
-
1251
1202
  function textContentSetterPatched(value) {
1252
1203
  textContextSetter.call(this, value);
1253
1204
  }
1254
-
1255
1205
  function parentNodeGetterPatched() {
1256
1206
  const value = parentNodeGetter.call(this);
1257
-
1258
1207
  if (isNull(value)) {
1259
1208
  return value;
1260
- } // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1261
-
1262
-
1209
+ }
1210
+ // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1263
1211
  return getShadowParent(this, value);
1264
1212
  }
1265
-
1266
1213
  function parentElementGetterPatched() {
1267
1214
  const value = parentNodeGetter.call(this);
1268
-
1269
1215
  if (isNull(value)) {
1270
1216
  return null;
1271
1217
  }
1272
-
1273
- const parentNode = getShadowParent(this, value); // it could be that the parentNode is the shadowRoot, in which case
1218
+ const parentNode = getShadowParent(this, value);
1219
+ // it could be that the parentNode is the shadowRoot, in which case
1274
1220
  // we need to return null.
1275
1221
  // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1276
-
1277
1222
  return parentNode instanceof Element ? parentNode : null;
1278
1223
  }
1279
-
1280
1224
  function compareDocumentPositionPatched(otherNode) {
1281
1225
  if (this === otherNode) {
1282
1226
  return 0;
@@ -1286,48 +1230,38 @@
1286
1230
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
1287
1231
  // "this" and "otherNode" belongs to 2 different shadow tree.
1288
1232
  return 35; // Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING
1289
- } // Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
1233
+ }
1234
+ // Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
1290
1235
  // Node.compareDocumentPosition implementation.
1291
-
1292
-
1293
1236
  return compareDocumentPosition.call(this, otherNode);
1294
1237
  }
1295
-
1296
1238
  function containsPatched(otherNode) {
1297
1239
  if (otherNode == null || getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
1298
1240
  // it is from another shadow
1299
1241
  return false;
1300
1242
  }
1301
-
1302
1243
  return (compareDocumentPosition.call(this, otherNode) & DOCUMENT_POSITION_CONTAINED_BY) !== 0;
1303
1244
  }
1304
-
1305
1245
  function cloneNodePatched(deep) {
1306
- const clone = cloneNode.call(this, false); // Per spec, browsers only care about truthy values
1246
+ const clone = cloneNode.call(this, false);
1247
+ // Per spec, browsers only care about truthy values
1307
1248
  // Not strict true or false
1308
-
1309
1249
  if (!deep) {
1310
1250
  return clone;
1311
1251
  }
1312
-
1313
1252
  const childNodes = getInternalChildNodes(this);
1314
-
1315
1253
  for (let i = 0, len = childNodes.length; i < len; i += 1) {
1316
1254
  clone.appendChild(childNodes[i].cloneNode(true));
1317
1255
  }
1318
-
1319
1256
  return clone;
1320
1257
  }
1321
1258
  /**
1322
1259
  * This method only applies to elements with a shadow or slots
1323
1260
  */
1324
-
1325
-
1326
1261
  function childNodesGetterPatched() {
1327
1262
  if (isSyntheticShadowHost(this)) {
1328
1263
  const owner = getNodeOwner(this);
1329
1264
  const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1330
-
1331
1265
  if (process.env.NODE_ENV !== 'production' && isFalse(hasNativeSymbolSupport) && isExternalChildNodeAccessorFlagOn()) {
1332
1266
  // inserting a comment node as the first childNode to trick the IE11
1333
1267
  // DevTool to show the content of the shadowRoot, this should only happen
@@ -1335,30 +1269,24 @@
1335
1269
  // Plus it should only be in place if we know it is an external invoker.
1336
1270
  ArrayUnshift.call(childNodes, getIE11FakeShadowRootPlaceholder(this));
1337
1271
  }
1338
-
1339
1272
  return createStaticNodeList(childNodes);
1340
- } // nothing to do here since this does not have a synthetic shadow attached to it
1273
+ }
1274
+ // nothing to do here since this does not have a synthetic shadow attached to it
1341
1275
  // TODO [#1636]: what about slot elements?
1342
-
1343
-
1344
1276
  return childNodesGetter.call(this);
1345
1277
  }
1346
-
1347
1278
  const nativeGetRootNode = _Node.prototype.getRootNode;
1348
1279
  /**
1349
1280
  * Get the root by climbing up the dom tree, beyond the shadow root
1350
1281
  * If Node.prototype.getRootNode is supported, use it
1351
1282
  * else, assume we are working in non-native shadow mode and climb using parentNode
1352
1283
  */
1353
-
1354
1284
  const getDocumentOrRootNode = !isUndefined(nativeGetRootNode) ? nativeGetRootNode : function () {
1355
1285
  let node = this;
1356
1286
  let nodeParent;
1357
-
1358
1287
  while (!isNull(nodeParent = parentNodeGetter.call(node))) {
1359
1288
  node = nodeParent;
1360
1289
  }
1361
-
1362
1290
  return node;
1363
1291
  };
1364
1292
  /**
@@ -1370,15 +1298,12 @@
1370
1298
  * of a native shadow or the synthetic shadow.
1371
1299
  * @param {Node} node
1372
1300
  */
1373
-
1374
1301
  function getNearestRoot(node) {
1375
1302
  const ownerNode = getNodeOwner(node);
1376
-
1377
1303
  if (isNull(ownerNode)) {
1378
1304
  // we hit a wall, either we are in native shadow mode or the node is not in lwc boundary.
1379
1305
  return getDocumentOrRootNode.call(node);
1380
1306
  }
1381
-
1382
1307
  return getShadowRoot(ownerNode);
1383
1308
  }
1384
1309
  /**
@@ -1400,25 +1325,20 @@
1400
1325
  * _Spec_: https://dom.spec.whatwg.org/#dom-node-getrootnode
1401
1326
  *
1402
1327
  **/
1403
-
1404
-
1405
1328
  function getRootNodePatched(options) {
1406
1329
  const composed = isUndefined(options) ? false : !!options.composed;
1407
1330
  return isTrue(composed) ? getDocumentOrRootNode.call(this, options) : getNearestRoot(this);
1408
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
1331
+ }
1332
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
1409
1333
  // do not give access to nodes beyond the immediate children.
1410
-
1411
-
1412
1334
  defineProperties(_Node.prototype, {
1413
1335
  firstChild: {
1414
1336
  get() {
1415
1337
  if (hasMountedChildren(this)) {
1416
1338
  return firstChildGetterPatched.call(this);
1417
1339
  }
1418
-
1419
1340
  return firstChildGetter.call(this);
1420
1341
  },
1421
-
1422
1342
  enumerable: true,
1423
1343
  configurable: true
1424
1344
  },
@@ -1427,10 +1347,8 @@
1427
1347
  if (hasMountedChildren(this)) {
1428
1348
  return lastChildGetterPatched.call(this);
1429
1349
  }
1430
-
1431
1350
  return lastChildGetter.call(this);
1432
1351
  },
1433
-
1434
1352
  enumerable: true,
1435
1353
  configurable: true
1436
1354
  },
@@ -1440,18 +1358,14 @@
1440
1358
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1441
1359
  return textContentGetterPatched.call(this);
1442
1360
  }
1443
-
1444
1361
  return textContentGetter.call(this);
1445
- } // TODO [#1222]: remove global bypass
1446
-
1447
-
1362
+ }
1363
+ // TODO [#1222]: remove global bypass
1448
1364
  if (isGlobalPatchingSkipped(this)) {
1449
1365
  return textContentGetter.call(this);
1450
1366
  }
1451
-
1452
1367
  return textContentGetterPatched.call(this);
1453
1368
  },
1454
-
1455
1369
  set: textContentSetterPatched,
1456
1370
  enumerable: true,
1457
1371
  configurable: true
@@ -1461,17 +1375,14 @@
1461
1375
  if (isNodeShadowed(this)) {
1462
1376
  return parentNodeGetterPatched.call(this);
1463
1377
  }
1464
-
1465
- const parentNode = parentNodeGetter.call(this); // Handle the case where a top level light DOM element is slotted into a synthetic
1378
+ const parentNode = parentNodeGetter.call(this);
1379
+ // Handle the case where a top level light DOM element is slotted into a synthetic
1466
1380
  // shadow slot.
1467
-
1468
1381
  if (!isNull(parentNode) && isSyntheticSlotElement(parentNode)) {
1469
1382
  return getNodeOwner(parentNode);
1470
1383
  }
1471
-
1472
1384
  return parentNode;
1473
1385
  },
1474
-
1475
1386
  enumerable: true,
1476
1387
  configurable: true
1477
1388
  },
@@ -1480,17 +1391,14 @@
1480
1391
  if (isNodeShadowed(this)) {
1481
1392
  return parentElementGetterPatched.call(this);
1482
1393
  }
1483
-
1484
- const parentElement = parentElementGetter.call(this); // Handle the case where a top level light DOM element is slotted into a synthetic
1394
+ const parentElement = parentElementGetter.call(this);
1395
+ // Handle the case where a top level light DOM element is slotted into a synthetic
1485
1396
  // shadow slot.
1486
-
1487
1397
  if (!isNull(parentElement) && isSyntheticSlotElement(parentElement)) {
1488
1398
  return getNodeOwner(parentElement);
1489
1399
  }
1490
-
1491
1400
  return parentElement;
1492
1401
  },
1493
-
1494
1402
  enumerable: true,
1495
1403
  configurable: true
1496
1404
  },
@@ -1499,10 +1407,8 @@
1499
1407
  if (hasMountedChildren(this)) {
1500
1408
  return childNodesGetterPatched.call(this);
1501
1409
  }
1502
-
1503
1410
  return childNodesGetter.call(this);
1504
1411
  },
1505
-
1506
1412
  enumerable: true,
1507
1413
  configurable: true
1508
1414
  },
@@ -1511,10 +1417,8 @@
1511
1417
  if (hasMountedChildren(this)) {
1512
1418
  return hasChildNodesPatched.call(this);
1513
1419
  }
1514
-
1515
1420
  return hasChildNodes.call(this);
1516
1421
  },
1517
-
1518
1422
  enumerable: true,
1519
1423
  writable: true,
1520
1424
  configurable: true
@@ -1525,10 +1429,8 @@
1525
1429
  if (isGlobalPatchingSkipped(this)) {
1526
1430
  return compareDocumentPosition.call(this, otherNode);
1527
1431
  }
1528
-
1529
1432
  return compareDocumentPositionPatched.call(this, otherNode);
1530
1433
  },
1531
-
1532
1434
  enumerable: true,
1533
1435
  writable: true,
1534
1436
  configurable: true
@@ -1542,27 +1444,21 @@
1542
1444
  if (this === otherNode) {
1543
1445
  return true;
1544
1446
  }
1545
-
1546
1447
  if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1547
1448
  if (otherNode == null) {
1548
1449
  return false;
1549
1450
  }
1550
-
1551
1451
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1552
1452
  return containsPatched.call(this, otherNode);
1553
1453
  }
1554
-
1555
1454
  return contains.call(this, otherNode);
1556
- } // TODO [#1222]: remove global bypass
1557
-
1558
-
1455
+ }
1456
+ // TODO [#1222]: remove global bypass
1559
1457
  if (isGlobalPatchingSkipped(this)) {
1560
1458
  return contains.call(this, otherNode);
1561
1459
  }
1562
-
1563
1460
  return containsPatched.call(this, otherNode);
1564
1461
  },
1565
-
1566
1462
  enumerable: true,
1567
1463
  writable: true,
1568
1464
  configurable: true
@@ -1573,22 +1469,17 @@
1573
1469
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1574
1470
  return cloneNodePatched.call(this, deep);
1575
1471
  }
1576
-
1577
1472
  return cloneNode.call(this, deep);
1578
1473
  }
1579
-
1580
1474
  if (isTrue(deep)) {
1581
1475
  // TODO [#1222]: remove global bypass
1582
1476
  if (isGlobalPatchingSkipped(this)) {
1583
1477
  return cloneNode.call(this, deep);
1584
1478
  }
1585
-
1586
1479
  return cloneNodePatched.call(this, deep);
1587
1480
  }
1588
-
1589
1481
  return cloneNode.call(this, deep);
1590
1482
  },
1591
-
1592
1483
  enumerable: true,
1593
1484
  writable: true,
1594
1485
  configurable: true
@@ -1602,11 +1493,9 @@
1602
1493
  isConnected: {
1603
1494
  enumerable: true,
1604
1495
  configurable: true,
1605
-
1606
1496
  get() {
1607
1497
  return isConnected.call(this);
1608
1498
  }
1609
-
1610
1499
  }
1611
1500
  });
1612
1501
  let internalChildNodeAccessorFlag = false;
@@ -1616,7 +1505,6 @@
1616
1505
  * or from an external invoker. This helps to produce the right output in one very peculiar
1617
1506
  * case, the IE11 debugging comment for shadowRoot representation on the devtool.
1618
1507
  */
1619
-
1620
1508
  function isExternalChildNodeAccessorFlagOn() {
1621
1509
  return !internalChildNodeAccessorFlag;
1622
1510
  }
@@ -1624,7 +1512,6 @@
1624
1512
  internalChildNodeAccessorFlag = true;
1625
1513
  let childNodes;
1626
1514
  let error = null;
1627
-
1628
1515
  try {
1629
1516
  childNodes = node.childNodes;
1630
1517
  } catch (e) {
@@ -1632,7 +1519,6 @@
1632
1519
  error = e;
1633
1520
  } finally {
1634
1521
  internalChildNodeAccessorFlag = false;
1635
-
1636
1522
  if (!isNull(error)) {
1637
1523
  // re-throwing after restoring the state machinery for setInternalChildNodeAccessorFlag
1638
1524
  throw error; // eslint-disable-line no-unsafe-finally
@@ -1642,12 +1528,11 @@
1642
1528
  return childNodes;
1643
1529
  } : function (node) {
1644
1530
  return node.childNodes;
1645
- }; // IE11 extra patches for wrong prototypes
1646
-
1531
+ };
1532
+ // IE11 extra patches for wrong prototypes
1647
1533
  if (hasOwnProperty.call(HTMLElement.prototype, 'contains')) {
1648
1534
  defineProperty(HTMLElement.prototype, 'contains', getOwnPropertyDescriptor(_Node.prototype, 'contains'));
1649
1535
  }
1650
-
1651
1536
  if (hasOwnProperty.call(HTMLElement.prototype, 'parentElement')) {
1652
1537
  defineProperty(HTMLElement.prototype, 'parentElement', getOwnPropertyDescriptor(_Node.prototype, 'parentElement'));
1653
1538
  }
@@ -3806,66 +3691,52 @@
3806
3691
  * SPDX-License-Identifier: MIT
3807
3692
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3808
3693
  */
3809
-
3810
3694
  function innerHTMLGetterPatched() {
3811
3695
  const childNodes = getInternalChildNodes(this);
3812
3696
  let innerHTML = '';
3813
-
3814
3697
  for (let i = 0, len = childNodes.length; i < len; i += 1) {
3815
3698
  innerHTML += getOuterHTML(childNodes[i]);
3816
3699
  }
3817
-
3818
3700
  return innerHTML;
3819
3701
  }
3820
-
3821
3702
  function outerHTMLGetterPatched() {
3822
3703
  return getOuterHTML(this);
3823
3704
  }
3824
-
3825
3705
  function attachShadowPatched(options) {
3826
3706
  // To retain native behavior of the API, provide synthetic shadowRoot only when specified
3827
3707
  if (options[KEY__SYNTHETIC_MODE]) {
3828
3708
  return attachShadow(this, options);
3829
3709
  }
3830
-
3831
3710
  return attachShadow$1.call(this, options);
3832
3711
  }
3833
-
3834
3712
  function shadowRootGetterPatched() {
3835
3713
  if (isSyntheticShadowHost(this)) {
3836
3714
  const shadow = getShadowRoot(this);
3837
-
3838
3715
  if (shadow.mode === 'open') {
3839
3716
  return shadow;
3840
3717
  }
3841
3718
  }
3842
-
3843
3719
  return shadowRootGetter.call(this);
3844
3720
  }
3845
-
3846
3721
  function childrenGetterPatched() {
3847
3722
  const owner = getNodeOwner(this);
3848
3723
  const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
3849
3724
  return createStaticHTMLCollection(ArrayFilter.call(childNodes, node => node instanceof Element));
3850
3725
  }
3851
-
3852
3726
  function childElementCountGetterPatched() {
3853
3727
  return this.children.length;
3854
3728
  }
3855
-
3856
3729
  function firstElementChildGetterPatched() {
3857
3730
  return this.children[0] || null;
3858
3731
  }
3859
-
3860
3732
  function lastElementChildGetterPatched() {
3861
3733
  const {
3862
3734
  children
3863
3735
  } = this;
3864
3736
  return children.item(children.length - 1) || null;
3865
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
3737
+ }
3738
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
3866
3739
  // do not five access to nodes beyond the immediate children.
3867
-
3868
-
3869
3740
  defineProperties(Element.prototype, {
3870
3741
  innerHTML: {
3871
3742
  get() {
@@ -3873,22 +3744,17 @@
3873
3744
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3874
3745
  return innerHTMLGetterPatched.call(this);
3875
3746
  }
3876
-
3877
3747
  return innerHTMLGetter.call(this);
3878
- } // TODO [#1222]: remove global bypass
3879
-
3880
-
3748
+ }
3749
+ // TODO [#1222]: remove global bypass
3881
3750
  if (isGlobalPatchingSkipped(this)) {
3882
3751
  return innerHTMLGetter.call(this);
3883
3752
  }
3884
-
3885
3753
  return innerHTMLGetterPatched.call(this);
3886
3754
  },
3887
-
3888
3755
  set(v) {
3889
3756
  innerHTMLSetter.call(this, v);
3890
3757
  },
3891
-
3892
3758
  enumerable: true,
3893
3759
  configurable: true
3894
3760
  },
@@ -3898,22 +3764,17 @@
3898
3764
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3899
3765
  return outerHTMLGetterPatched.call(this);
3900
3766
  }
3901
-
3902
3767
  return outerHTMLGetter.call(this);
3903
- } // TODO [#1222]: remove global bypass
3904
-
3905
-
3768
+ }
3769
+ // TODO [#1222]: remove global bypass
3906
3770
  if (isGlobalPatchingSkipped(this)) {
3907
3771
  return outerHTMLGetter.call(this);
3908
3772
  }
3909
-
3910
3773
  return outerHTMLGetterPatched.call(this);
3911
3774
  },
3912
-
3913
3775
  set(v) {
3914
3776
  outerHTMLSetter.call(this, v);
3915
3777
  },
3916
-
3917
3778
  enumerable: true,
3918
3779
  configurable: true
3919
3780
  },
@@ -3934,10 +3795,8 @@
3934
3795
  if (hasMountedChildren(this)) {
3935
3796
  return childrenGetterPatched.call(this);
3936
3797
  }
3937
-
3938
3798
  return childrenGetter.call(this);
3939
3799
  },
3940
-
3941
3800
  enumerable: true,
3942
3801
  configurable: true
3943
3802
  },
@@ -3946,10 +3805,8 @@
3946
3805
  if (hasMountedChildren(this)) {
3947
3806
  return childElementCountGetterPatched.call(this);
3948
3807
  }
3949
-
3950
3808
  return childElementCountGetter.call(this);
3951
3809
  },
3952
-
3953
3810
  enumerable: true,
3954
3811
  configurable: true
3955
3812
  },
@@ -3958,10 +3815,8 @@
3958
3815
  if (hasMountedChildren(this)) {
3959
3816
  return firstElementChildGetterPatched.call(this);
3960
3817
  }
3961
-
3962
3818
  return firstElementChildGetter.call(this);
3963
3819
  },
3964
-
3965
3820
  enumerable: true,
3966
3821
  configurable: true
3967
3822
  },
@@ -3970,10 +3825,8 @@
3970
3825
  if (hasMountedChildren(this)) {
3971
3826
  return lastElementChildGetterPatched.call(this);
3972
3827
  }
3973
-
3974
3828
  return lastElementChildGetter.call(this);
3975
3829
  },
3976
-
3977
3830
  enumerable: true,
3978
3831
  configurable: true
3979
3832
  },
@@ -3982,28 +3835,23 @@
3982
3835
  enumerable: true,
3983
3836
  configurable: true
3984
3837
  }
3985
- }); // IE11 extra patches for wrong prototypes
3986
-
3838
+ });
3839
+ // IE11 extra patches for wrong prototypes
3987
3840
  if (hasOwnProperty.call(HTMLElement.prototype, 'innerHTML')) {
3988
3841
  defineProperty(HTMLElement.prototype, 'innerHTML', getOwnPropertyDescriptor(Element.prototype, 'innerHTML'));
3989
3842
  }
3990
-
3991
3843
  if (hasOwnProperty.call(HTMLElement.prototype, 'outerHTML')) {
3992
3844
  defineProperty(HTMLElement.prototype, 'outerHTML', getOwnPropertyDescriptor(Element.prototype, 'outerHTML'));
3993
3845
  }
3994
-
3995
3846
  if (hasOwnProperty.call(HTMLElement.prototype, 'children')) {
3996
3847
  defineProperty(HTMLElement.prototype, 'children', getOwnPropertyDescriptor(Element.prototype, 'children'));
3997
- } // Deep-traversing patches from this point on:
3998
-
3999
-
3848
+ }
3849
+ // Deep-traversing patches from this point on:
4000
3850
  function querySelectorPatched() {
4001
3851
  const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
4002
-
4003
3852
  if (isSyntheticShadowHost(this)) {
4004
3853
  // element with shadowRoot attached
4005
3854
  const owner = getNodeOwner(this);
4006
-
4007
3855
  if (!isUndefined(getNodeKey(this))) {
4008
3856
  // it is a custom element, and we should then filter by slotted elements
4009
3857
  return getFirstSlottedMatch(this, nodeList);
@@ -4016,7 +3864,6 @@
4016
3864
  } else if (isNodeShadowed(this)) {
4017
3865
  // element inside a shadowRoot
4018
3866
  const ownerKey = getNodeOwnerKey(this);
4019
-
4020
3867
  if (!isUndefined(ownerKey)) {
4021
3868
  // `this` is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
4022
3869
  const elm = ArrayFind.call(nodeList, elm => getNodeNearestOwnerKey(elm) === ownerKey);
@@ -4025,10 +3872,9 @@
4025
3872
  if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
4026
3873
  // `this` is a manually inserted element inside a shadowRoot, return the first element.
4027
3874
  return nodeList.length === 0 ? null : nodeList[0];
4028
- } // Element is inside a shadow but we dont know which one. Use the
3875
+ }
3876
+ // Element is inside a shadow but we dont know which one. Use the
4029
3877
  // "nearest" owner key to filter by ownership.
4030
-
4031
-
4032
3878
  const contextNearestOwnerKey = getNodeNearestOwnerKey(this);
4033
3879
  const elm = ArrayFind.call(nodeList, elm => getNodeNearestOwnerKey(elm) === contextNearestOwnerKey);
4034
3880
  return isUndefined(elm) ? null : elm;
@@ -4039,22 +3885,19 @@
4039
3885
  const elm = nodeList[0];
4040
3886
  return isUndefined(elm) ? null : elm;
4041
3887
  }
4042
- } // element belonging to the document
4043
-
4044
-
4045
- const elm = ArrayFind.call(nodeList, // TODO [#1222]: remove global bypass
3888
+ }
3889
+ // element belonging to the document
3890
+ const elm = ArrayFind.call(nodeList,
3891
+ // TODO [#1222]: remove global bypass
4046
3892
  elm => isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(this));
4047
3893
  return isUndefined(elm) ? null : elm;
4048
3894
  }
4049
3895
  }
4050
-
4051
3896
  function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
4052
3897
  let filtered;
4053
-
4054
3898
  if (isSyntheticShadowHost(context)) {
4055
3899
  // element with shadowRoot attached
4056
3900
  const owner = getNodeOwner(context);
4057
-
4058
3901
  if (!isUndefined(getNodeKey(context))) {
4059
3902
  // it is a custom element, and we should then filter by slotted elements
4060
3903
  filtered = getAllSlottedMatches(context, unfilteredNodes);
@@ -4067,13 +3910,10 @@
4067
3910
  } else if (isNodeShadowed(context)) {
4068
3911
  // element inside a shadowRoot
4069
3912
  const ownerKey = getNodeOwnerKey(context);
4070
-
4071
3913
  if (!isUndefined(ownerKey)) {
4072
3914
  // context is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
4073
3915
  filtered = ArrayFilter.call(unfilteredNodes, elm => getNodeNearestOwnerKey(elm) === ownerKey);
4074
- } else if (shadowDomSemantic === 1
4075
- /* ShadowDomSemantic.Enabled */
4076
- ) {
3916
+ } else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
4077
3917
  // context is inside a shadow, we dont know which one.
4078
3918
  const contextNearestOwnerKey = getNodeNearestOwnerKey(context);
4079
3919
  filtered = ArrayFilter.call(unfilteredNodes, elm => getNodeNearestOwnerKey(elm) === contextNearestOwnerKey);
@@ -4082,20 +3922,19 @@
4082
3922
  filtered = ArraySlice.call(unfilteredNodes);
4083
3923
  }
4084
3924
  } else {
4085
- if (context instanceof HTMLBodyElement || shadowDomSemantic === 1
4086
- /* ShadowDomSemantic.Enabled */
4087
- ) {
3925
+ if (context instanceof HTMLBodyElement || shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
4088
3926
  // `context` is document.body or element belonging to the document with the patch enabled
4089
- filtered = ArrayFilter.call(unfilteredNodes, // TODO [#1222]: remove global bypass
3927
+ filtered = ArrayFilter.call(unfilteredNodes,
3928
+ // TODO [#1222]: remove global bypass
4090
3929
  elm => isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context));
4091
3930
  } else {
4092
3931
  // `context` is outside the lwc boundary and patch is not enabled.
4093
3932
  filtered = ArraySlice.call(unfilteredNodes);
4094
3933
  }
4095
3934
  }
4096
-
4097
3935
  return filtered;
4098
- } // The following patched methods hide shadowed elements from global
3936
+ }
3937
+ // The following patched methods hide shadowed elements from global
4099
3938
  // traversing mechanisms. They are simplified for performance reasons to
4100
3939
  // filter by ownership and do not account for slotted elements. This
4101
3940
  // compromise is fine for our synthetic shadow dom because root elements
@@ -4104,8 +3943,6 @@
4104
3943
  // static HTMLCollection or static NodeList. We decided that this compromise
4105
3944
  // is not a big problem considering the amount of code that is relying on
4106
3945
  // the liveliness of these results are rare.
4107
-
4108
-
4109
3946
  defineProperties(Element.prototype, {
4110
3947
  querySelector: {
4111
3948
  value: querySelectorPatched,
@@ -4116,41 +3953,30 @@
4116
3953
  querySelectorAll: {
4117
3954
  value() {
4118
3955
  const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
4119
-
4120
3956
  if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
4121
- const filteredResults = getFilteredArrayOfNodes(this, nodeList, 0
4122
- /* ShadowDomSemantic.Disabled */
4123
- );
3957
+ const filteredResults = getFilteredArrayOfNodes(this, nodeList, 0 /* ShadowDomSemantic.Disabled */);
4124
3958
  return createStaticNodeList(filteredResults);
4125
3959
  }
4126
-
4127
- return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1
4128
- /* ShadowDomSemantic.Enabled */
4129
- ));
3960
+ return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
4130
3961
  },
4131
3962
 
4132
3963
  writable: true,
4133
3964
  enumerable: true,
4134
3965
  configurable: true
4135
3966
  }
4136
- }); // The following APIs are used directly by Jest internally so we avoid patching them during testing.
4137
-
3967
+ });
3968
+ // The following APIs are used directly by Jest internally so we avoid patching them during testing.
4138
3969
  if (process.env.NODE_ENV !== 'test') {
4139
3970
  defineProperties(Element.prototype, {
4140
3971
  getElementsByClassName: {
4141
3972
  value() {
4142
3973
  const elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
4143
-
4144
3974
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4145
3975
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4146
3976
  }
4147
-
4148
- const filteredResults = getFilteredArrayOfNodes(this, elements, 1
4149
- /* ShadowDomSemantic.Enabled */
4150
- );
3977
+ const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4151
3978
  return createStaticHTMLCollection(filteredResults);
4152
3979
  },
4153
-
4154
3980
  writable: true,
4155
3981
  enumerable: true,
4156
3982
  configurable: true
@@ -4158,17 +3984,12 @@
4158
3984
  getElementsByTagName: {
4159
3985
  value() {
4160
3986
  const elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
4161
-
4162
3987
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4163
3988
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4164
3989
  }
4165
-
4166
- const filteredResults = getFilteredArrayOfNodes(this, elements, 1
4167
- /* ShadowDomSemantic.Enabled */
4168
- );
3990
+ const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4169
3991
  return createStaticHTMLCollection(filteredResults);
4170
3992
  },
4171
-
4172
3993
  writable: true,
4173
3994
  enumerable: true,
4174
3995
  configurable: true
@@ -4176,25 +3997,19 @@
4176
3997
  getElementsByTagNameNS: {
4177
3998
  value() {
4178
3999
  const elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
4179
-
4180
4000
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4181
4001
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4182
4002
  }
4183
-
4184
- const filteredResults = getFilteredArrayOfNodes(this, elements, 1
4185
- /* ShadowDomSemantic.Enabled */
4186
- );
4003
+ const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4187
4004
  return createStaticHTMLCollection(filteredResults);
4188
4005
  },
4189
-
4190
4006
  writable: true,
4191
4007
  enumerable: true,
4192
4008
  configurable: true
4193
4009
  }
4194
4010
  });
4195
- } // IE11 extra patches for wrong prototypes
4196
-
4197
-
4011
+ }
4012
+ // IE11 extra patches for wrong prototypes
4198
4013
  if (hasOwnProperty.call(HTMLElement.prototype, 'getElementsByClassName')) {
4199
4014
  defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
4200
4015
  }
@@ -4742,21 +4557,17 @@
4742
4557
  /**
4743
4558
  * This method only applies to elements with a shadow attached to them
4744
4559
  */
4745
-
4746
4560
  function tabIndexGetterPatched() {
4747
4561
  if (isDelegatingFocus(this) && isFalse(hasAttribute.call(this, 'tabindex'))) {
4748
4562
  // this covers the case where the default tabindex should be 0 because the
4749
4563
  // custom element is delegating its focus
4750
4564
  return 0;
4751
4565
  }
4752
-
4753
4566
  return tabIndexGetter.call(this);
4754
4567
  }
4755
4568
  /**
4756
4569
  * This method only applies to elements with a shadow attached to them
4757
4570
  */
4758
-
4759
-
4760
4571
  function tabIndexSetterPatched(value) {
4761
4572
  // This tabIndex setter might be confusing unless it is understood that HTML
4762
4573
  // elements have default tabIndex property values. Natively focusable elements have
@@ -4764,53 +4575,48 @@
4764
4575
  // value of -1. For example, the tabIndex property value is -1 for both <x-foo> and
4765
4576
  // <x-foo tabindex="-1">, but our delegatesFocus polyfill should only kick in for
4766
4577
  // the latter case when the value of the tabindex attribute is -1.
4767
- const delegatesFocus = isDelegatingFocus(this); // Record the state of things before invoking component setter.
4768
-
4578
+ const delegatesFocus = isDelegatingFocus(this);
4579
+ // Record the state of things before invoking component setter.
4769
4580
  const prevValue = tabIndexGetter.call(this);
4770
4581
  const prevHasAttr = hasAttribute.call(this, 'tabindex');
4771
- tabIndexSetter.call(this, value); // Record the state of things after invoking component setter.
4772
-
4582
+ tabIndexSetter.call(this, value);
4583
+ // Record the state of things after invoking component setter.
4773
4584
  const currValue = tabIndexGetter.call(this);
4774
4585
  const currHasAttr = hasAttribute.call(this, 'tabindex');
4775
- const didValueChange = prevValue !== currValue; // If the tabindex attribute is initially rendered, we can assume that this setter has
4586
+ const didValueChange = prevValue !== currValue;
4587
+ // If the tabindex attribute is initially rendered, we can assume that this setter has
4776
4588
  // previously executed and a listener has been added. We must remove that listener if
4777
4589
  // the tabIndex property value has changed or if the component no longer renders a
4778
4590
  // tabindex attribute.
4779
-
4780
4591
  if (prevHasAttr && (didValueChange || isFalse(currHasAttr))) {
4781
4592
  if (prevValue === -1) {
4782
4593
  ignoreFocusIn(this);
4783
4594
  }
4784
-
4785
4595
  if (prevValue === 0 && delegatesFocus) {
4786
4596
  ignoreFocus(this);
4787
4597
  }
4788
- } // If a tabindex attribute was not rendered after invoking its setter, it means the
4598
+ }
4599
+ // If a tabindex attribute was not rendered after invoking its setter, it means the
4789
4600
  // component is taking control. Do nothing.
4790
-
4791
-
4792
4601
  if (isFalse(currHasAttr)) {
4793
4602
  return;
4794
- } // If the tabindex attribute is initially rendered, we can assume that this setter has
4603
+ }
4604
+ // If the tabindex attribute is initially rendered, we can assume that this setter has
4795
4605
  // previously executed and a listener has been added. If the tabindex attribute is still
4796
4606
  // rendered after invoking the setter AND the tabIndex property value has not changed,
4797
4607
  // we don't need to do any work.
4798
-
4799
-
4800
4608
  if (prevHasAttr && currHasAttr && isFalse(didValueChange)) {
4801
4609
  return;
4802
- } // At this point we know that a tabindex attribute was rendered after invoking the
4610
+ }
4611
+ // At this point we know that a tabindex attribute was rendered after invoking the
4803
4612
  // setter and that either:
4804
4613
  // 1) This is the first time this setter is being invoked.
4805
4614
  // 2) This is not the first time this setter is being invoked and the value is changing.
4806
4615
  // We need to add the appropriate listeners in either case.
4807
-
4808
-
4809
4616
  if (currValue === -1) {
4810
4617
  // Add the magic to skip the shadow tree
4811
4618
  handleFocusIn(this);
4812
4619
  }
4813
-
4814
4620
  if (currValue === 0 && delegatesFocus) {
4815
4621
  // Add the magic to skip the host element
4816
4622
  handleFocus(this);
@@ -4819,64 +4625,52 @@
4819
4625
  /**
4820
4626
  * This method only applies to elements with a shadow attached to them
4821
4627
  */
4822
-
4823
-
4824
4628
  function blurPatched() {
4825
4629
  if (isDelegatingFocus(this)) {
4826
4630
  const currentActiveElement = getActiveElement(this);
4827
-
4828
4631
  if (!isNull(currentActiveElement)) {
4829
4632
  // if there is an active element, blur it (intentionally using the dot notation in case the user defines the blur routine)
4830
4633
  currentActiveElement.blur();
4831
4634
  return;
4832
4635
  }
4833
4636
  }
4834
-
4835
4637
  return blur.call(this);
4836
4638
  }
4837
-
4838
4639
  function focusPatched() {
4839
4640
  // Save enabled state
4840
- const originallyEnabled = isKeyboardFocusNavigationRoutineEnabled(); // Change state by disabling if originally enabled
4841
-
4641
+ const originallyEnabled = isKeyboardFocusNavigationRoutineEnabled();
4642
+ // Change state by disabling if originally enabled
4842
4643
  if (originallyEnabled) {
4843
4644
  disableKeyboardFocusNavigationRoutines();
4844
4645
  }
4845
-
4846
4646
  if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
4847
4647
  hostElementFocus.call(this);
4848
4648
  return;
4849
- } // Typescript does not like it when you treat the `arguments` object as an array
4649
+ }
4650
+ // Typescript does not like it when you treat the `arguments` object as an array
4850
4651
  // @ts-ignore type-mismatch
4851
-
4852
-
4853
- focus.apply(this, arguments); // Restore state by enabling if originally enabled
4854
-
4652
+ focus.apply(this, arguments);
4653
+ // Restore state by enabling if originally enabled
4855
4654
  if (originallyEnabled) {
4856
4655
  enableKeyboardFocusNavigationRoutines();
4857
4656
  }
4858
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
4657
+ }
4658
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
4859
4659
  // do not five access to nodes beyond the immediate children.
4860
-
4861
-
4862
4660
  defineProperties(HTMLElement.prototype, {
4863
4661
  tabIndex: {
4864
4662
  get() {
4865
4663
  if (isSyntheticShadowHost(this)) {
4866
4664
  return tabIndexGetterPatched.call(this);
4867
4665
  }
4868
-
4869
4666
  return tabIndexGetter.call(this);
4870
4667
  },
4871
-
4872
4668
  set(v) {
4873
4669
  if (isSyntheticShadowHost(this)) {
4874
4670
  return tabIndexSetterPatched.call(this, v);
4875
4671
  }
4876
-
4877
4672
  return tabIndexSetter.call(this, v);
4878
4673
  },
4879
-
4880
4674
  enumerable: true,
4881
4675
  configurable: true
4882
4676
  },
@@ -4885,10 +4679,8 @@
4885
4679
  if (isSyntheticShadowHost(this)) {
4886
4680
  return blurPatched.call(this);
4887
4681
  }
4888
-
4889
4682
  blur.call(this);
4890
4683
  },
4891
-
4892
4684
  enumerable: true,
4893
4685
  writable: true,
4894
4686
  configurable: true
@@ -4899,46 +4691,38 @@
4899
4691
  // @ts-ignore type-mismatch
4900
4692
  focusPatched.apply(this, arguments);
4901
4693
  },
4902
-
4903
4694
  enumerable: true,
4904
4695
  writable: true,
4905
4696
  configurable: true
4906
4697
  }
4907
- }); // Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
4908
-
4698
+ });
4699
+ // Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
4909
4700
  if (innerTextGetter !== null && innerTextSetter !== null) {
4910
4701
  defineProperty(HTMLElement.prototype, 'innerText', {
4911
4702
  get() {
4912
4703
  if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4913
4704
  return innerTextGetter.call(this);
4914
4705
  }
4915
-
4916
4706
  if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4917
4707
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4918
4708
  return getInnerText(this);
4919
4709
  }
4920
-
4921
4710
  return innerTextGetter.call(this);
4922
- } // TODO [#1222]: remove global bypass
4923
-
4924
-
4711
+ }
4712
+ // TODO [#1222]: remove global bypass
4925
4713
  if (isGlobalPatchingSkipped(this)) {
4926
4714
  return innerTextGetter.call(this);
4927
4715
  }
4928
-
4929
4716
  return getInnerText(this);
4930
4717
  },
4931
-
4932
4718
  set(v) {
4933
4719
  innerTextSetter.call(this, v);
4934
4720
  },
4935
-
4936
4721
  enumerable: true,
4937
4722
  configurable: true
4938
4723
  });
4939
- } // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
4940
-
4941
-
4724
+ }
4725
+ // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
4942
4726
  if (outerTextGetter !== null && outerTextSetter !== null) {
4943
4727
  // From https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText :
4944
4728
  // HTMLElement.outerText is a non-standard property. As a getter, it returns the same value as Node.innerText.
@@ -4948,30 +4732,24 @@
4948
4732
  if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4949
4733
  return outerTextGetter.call(this);
4950
4734
  }
4951
-
4952
4735
  if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4953
4736
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4954
4737
  return getInnerText(this);
4955
4738
  }
4956
-
4957
4739
  return outerTextGetter.call(this);
4958
- } // TODO [#1222]: remove global bypass
4959
-
4960
-
4740
+ }
4741
+ // TODO [#1222]: remove global bypass
4961
4742
  if (isGlobalPatchingSkipped(this)) {
4962
4743
  return outerTextGetter.call(this);
4963
4744
  }
4964
-
4965
4745
  return getInnerText(this);
4966
4746
  },
4967
-
4968
4747
  set(v) {
4969
4748
  // Invoking the `outerText` setter on a host element should trigger its disconnection, but until we merge node reactions, it will not work.
4970
4749
  // We could reimplement the outerText setter in JavaScript ([blink implementation](https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/html/html_element.cc;l=841-879;drc=6e8b402a6231405b753919029c9027404325ea00;bpv=0;bpt=1))
4971
4750
  // but the benefits don't worth the efforts.
4972
4751
  outerTextSetter.call(this, v);
4973
4752
  },
4974
-
4975
4753
  enumerable: true,
4976
4754
  configurable: true
4977
4755
  });
@@ -5157,16 +4935,14 @@
5157
4935
  * SPDX-License-Identifier: MIT
5158
4936
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5159
4937
  */
4938
+ // Only used in LWC's Karma tests
5160
4939
  // @ts-ignore
5161
-
5162
4940
  if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
5163
4941
  window.addEventListener('test-dummy-flag', () => {
5164
4942
  let hasFlag = false;
5165
-
5166
4943
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
5167
4944
  hasFlag = true;
5168
4945
  }
5169
-
5170
4946
  window.dispatchEvent(new CustomEvent('has-dummy-flag', {
5171
4947
  detail: {
5172
4948
  package: '@lwc/synthetic-shadow',
@@ -5175,6 +4951,6 @@
5175
4951
  }));
5176
4952
  });
5177
4953
  }
5178
- /** version: 2.29.0 */
4954
+ /** version: 2.30.0 */
5179
4955
 
5180
4956
  }));