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
@@ -89,7 +89,7 @@
89
89
  const KEY__SHADOW_TOKEN = '$shadowToken$';
90
90
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
91
91
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
92
- /** version: 2.29.0 */
92
+ /** version: 2.30.0 */
93
93
 
94
94
  /*
95
95
  * Copyright (c) 2018, salesforce.com, inc.
@@ -403,7 +403,7 @@
403
403
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
404
404
  }
405
405
  const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
406
- /** version: 2.29.0 */
406
+ /** version: 2.30.0 */
407
407
 
408
408
  /*
409
409
  * Copyright (c) 2018, salesforce.com, inc.
@@ -411,22 +411,19 @@
411
411
  * SPDX-License-Identifier: MIT
412
412
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
413
413
  */
414
-
414
+ // Used as a back reference to identify the host element
415
415
  const HostElementKey = '$$HostElementKey$$';
416
416
  const ShadowedNodeKey = '$$ShadowedNodeKey$$';
417
-
418
417
  function fastDefineProperty(node, propName, config) {
419
418
  const shadowedNode = node;
420
-
421
419
  {
422
420
  const {
423
421
  value
424
- } = config; // in prod, we prioritize performance
425
-
422
+ } = config;
423
+ // in prod, we prioritize performance
426
424
  shadowedNode[propName] = value;
427
425
  }
428
426
  }
429
-
430
427
  function setNodeOwnerKey(node, value) {
431
428
  fastDefineProperty(node, HostElementKey, {
432
429
  value,
@@ -443,18 +440,15 @@
443
440
  }
444
441
  function getNodeNearestOwnerKey(node) {
445
442
  let host = node;
446
- let hostKey; // search for the first element with owner identity
443
+ let hostKey;
444
+ // search for the first element with owner identity
447
445
  // in case of manually inserted elements and elements slotted from Light DOM
448
-
449
446
  while (!isNull(host)) {
450
447
  hostKey = getNodeOwnerKey(host);
451
-
452
448
  if (!isUndefined(hostKey)) {
453
449
  return hostKey;
454
450
  }
455
-
456
451
  host = parentNodeGetter.call(host);
457
-
458
452
  if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
459
453
  if (!isNull(host) && isSyntheticSlotElement(host)) {
460
454
  return undefined;
@@ -470,7 +464,6 @@
470
464
  * cases. If we need to traverse up and verify those nodes that don't have owner key, use
471
465
  * isNodeDeepShadowed instead.
472
466
  */
473
-
474
467
  function isNodeShadowed(node) {
475
468
  return !isUndefined(getNodeOwnerKey(node));
476
469
  }
@@ -481,30 +474,24 @@
481
474
  * SPDX-License-Identifier: MIT
482
475
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
483
476
  */
477
+ // when finding a slot in the DOM, we can fold it if it is contained
484
478
  // inside another slot.
485
-
486
479
  function foldSlotElement(slot) {
487
480
  let parent = parentElementGetter.call(slot);
488
-
489
481
  while (!isNull(parent) && isSlotElement(parent)) {
490
482
  slot = parent;
491
483
  parent = parentElementGetter.call(slot);
492
484
  }
493
-
494
485
  return slot;
495
486
  }
496
-
497
487
  function isNodeSlotted(host, node) {
498
-
499
- const hostKey = getNodeKey(host); // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
488
+ const hostKey = getNodeKey(host);
489
+ // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
500
490
  // just in case the provided node is not an element
501
-
502
491
  let currentElement = node instanceof Element ? node : parentElementGetter.call(node);
503
-
504
492
  while (!isNull(currentElement) && currentElement !== host) {
505
493
  const elmOwnerKey = getNodeNearestOwnerKey(currentElement);
506
494
  const parent = parentElementGetter.call(currentElement);
507
-
508
495
  if (elmOwnerKey === hostKey) {
509
496
  // we have reached an element inside the host's template, and only if
510
497
  // that element is an slot, then the node is considered slotted
@@ -530,7 +517,6 @@
530
517
  * most outer slot parent before jumping into its corresponding host.
531
518
  */
532
519
  currentElement = getNodeOwner(foldSlotElement(parent));
533
-
534
520
  if (!isNull(currentElement)) {
535
521
  if (currentElement === host) {
536
522
  // the slot element is a top level element inside the shadow
@@ -549,32 +535,25 @@
549
535
  currentElement = parent;
550
536
  }
551
537
  }
552
-
553
538
  return false;
554
539
  }
555
-
556
540
  function getNodeOwner(node) {
557
541
  if (!(node instanceof _Node)) {
558
542
  return null;
559
543
  }
560
-
561
544
  const ownerKey = getNodeNearestOwnerKey(node);
562
-
563
545
  if (isUndefined(ownerKey)) {
564
546
  return null;
565
547
  }
566
-
567
- let nodeOwner = node; // At this point, node is a valid node with owner identity, now we need to find the owner node
548
+ let nodeOwner = node;
549
+ // At this point, node is a valid node with owner identity, now we need to find the owner node
568
550
  // search for a custom element with a VM that owns the first element with owner identity attached to it
569
-
570
551
  while (!isNull(nodeOwner) && getNodeKey(nodeOwner) !== ownerKey) {
571
552
  nodeOwner = parentNodeGetter.call(nodeOwner);
572
553
  }
573
-
574
554
  if (isNull(nodeOwner)) {
575
555
  return null;
576
556
  }
577
-
578
557
  return nodeOwner;
579
558
  }
580
559
  function isSyntheticSlotElement(node) {
@@ -584,23 +563,18 @@
584
563
  return node instanceof HTMLSlotElement;
585
564
  }
586
565
  function isNodeOwnedBy(owner, node) {
587
-
588
566
  const ownerKey = getNodeNearestOwnerKey(node);
589
-
590
567
  if (isUndefined(ownerKey)) {
591
568
  if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
592
569
  // in case of root level light DOM element slotting into a synthetic shadow
593
570
  const host = parentNodeGetter.call(node);
594
-
595
571
  if (!isNull(host) && isSyntheticSlotElement(host)) {
596
572
  return false;
597
573
  }
598
- } // in case of manually inserted elements
599
-
600
-
574
+ }
575
+ // in case of manually inserted elements
601
576
  return true;
602
577
  }
603
-
604
578
  return getNodeKey(owner) === ownerKey;
605
579
  }
606
580
  function shadowRootChildNodes(root) {
@@ -609,42 +583,34 @@
609
583
  }
610
584
  function getAllSlottedMatches(host, nodeList) {
611
585
  const filteredAndPatched = [];
612
-
613
586
  for (let i = 0, len = nodeList.length; i < len; i += 1) {
614
587
  const node = nodeList[i];
615
-
616
588
  if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
617
589
  ArrayPush.call(filteredAndPatched, node);
618
590
  }
619
591
  }
620
-
621
592
  return filteredAndPatched;
622
593
  }
623
594
  function getFirstSlottedMatch(host, nodeList) {
624
595
  for (let i = 0, len = nodeList.length; i < len; i += 1) {
625
596
  const node = nodeList[i];
626
-
627
597
  if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
628
598
  return node;
629
599
  }
630
600
  }
631
-
632
601
  return null;
633
602
  }
634
603
  function getAllMatches(owner, nodeList) {
635
604
  const filteredAndPatched = [];
636
-
637
605
  for (let i = 0, len = nodeList.length; i < len; i += 1) {
638
606
  const node = nodeList[i];
639
607
  const isOwned = isNodeOwnedBy(owner, node);
640
-
641
608
  if (isOwned) {
642
609
  // Patch querySelector, querySelectorAll, etc
643
610
  // if element is owned by VM
644
611
  ArrayPush.call(filteredAndPatched, node);
645
612
  }
646
613
  }
647
-
648
614
  return filteredAndPatched;
649
615
  }
650
616
  function getFirstMatch(owner, nodeList) {
@@ -653,7 +619,6 @@
653
619
  return nodeList[i];
654
620
  }
655
621
  }
656
-
657
622
  return null;
658
623
  }
659
624
  function shadowRootQuerySelector(root, selector) {
@@ -672,19 +637,17 @@
672
637
  const children = childNodesGetter.call(node);
673
638
  return arrayFromCollection(children);
674
639
  }
675
-
676
640
  if (isSyntheticShadowHost(node)) {
677
641
  // we need to get only the nodes that were slotted
678
642
  const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
679
- const resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
643
+ const resolver = getShadowRootResolver(getShadowRoot(node));
644
+ // Typescript is inferring the wrong function type for this particular
680
645
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
681
646
  // @ts-ignore type-mismatch
682
-
683
647
  return ArrayReduce.call(slots, (seed, slot) => {
684
648
  if (resolver === getShadowRootResolver(slot)) {
685
649
  ArrayPush.apply(seed, getFilteredSlotAssignedNodes(slot));
686
650
  }
687
-
688
651
  return seed;
689
652
  }, []);
690
653
  } else {
@@ -696,11 +659,9 @@
696
659
  }
697
660
  function getFilteredSlotAssignedNodes(slot) {
698
661
  const owner = getNodeOwner(slot);
699
-
700
662
  if (isNull(owner)) {
701
663
  return [];
702
664
  }
703
-
704
665
  const childNodes = arrayFromCollection(childNodesGetter.call(slot));
705
666
  return ArrayFilter.call(childNodes, child => !isNodeShadowed(child) || !isNodeOwnedBy(owner, child));
706
667
  }
@@ -1122,14 +1083,11 @@
1122
1083
  * and elements with shadow dom attached to them. It doesn't apply to native slot elements
1123
1084
  * because we don't want to patch the children getters for those elements.
1124
1085
  */
1125
-
1126
1086
  function hasMountedChildren(node) {
1127
1087
  return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
1128
1088
  }
1129
-
1130
1089
  function getShadowParent(node, value) {
1131
1090
  const owner = getNodeOwner(node);
1132
-
1133
1091
  if (value === owner) {
1134
1092
  // walking up via parent chain might end up in the shadow root element
1135
1093
  return getShadowRoot(owner);
@@ -1142,64 +1100,50 @@
1142
1100
  // where they slotted into, but its shadowed parent is always the
1143
1101
  // owner of the slot.
1144
1102
  const slotOwner = getNodeOwner(value);
1145
-
1146
1103
  if (!isNull(slotOwner) && isNodeOwnedBy(owner, slotOwner)) {
1147
1104
  // it is a slotted element, and therefore its parent is always going to be the host of the slot
1148
1105
  return slotOwner;
1149
1106
  }
1150
1107
  }
1151
1108
  }
1152
-
1153
1109
  return null;
1154
1110
  }
1155
-
1156
1111
  function hasChildNodesPatched() {
1157
1112
  return getInternalChildNodes(this).length > 0;
1158
1113
  }
1159
-
1160
1114
  function firstChildGetterPatched() {
1161
1115
  const childNodes = getInternalChildNodes(this);
1162
1116
  return childNodes[0] || null;
1163
1117
  }
1164
-
1165
1118
  function lastChildGetterPatched() {
1166
1119
  const childNodes = getInternalChildNodes(this);
1167
1120
  return childNodes[childNodes.length - 1] || null;
1168
1121
  }
1169
-
1170
1122
  function textContentGetterPatched() {
1171
1123
  return getTextContent(this);
1172
1124
  }
1173
-
1174
1125
  function textContentSetterPatched(value) {
1175
1126
  textContextSetter.call(this, value);
1176
1127
  }
1177
-
1178
1128
  function parentNodeGetterPatched() {
1179
1129
  const value = parentNodeGetter.call(this);
1180
-
1181
1130
  if (isNull(value)) {
1182
1131
  return value;
1183
- } // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1184
-
1185
-
1132
+ }
1133
+ // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1186
1134
  return getShadowParent(this, value);
1187
1135
  }
1188
-
1189
1136
  function parentElementGetterPatched() {
1190
1137
  const value = parentNodeGetter.call(this);
1191
-
1192
1138
  if (isNull(value)) {
1193
1139
  return null;
1194
1140
  }
1195
-
1196
- const parentNode = getShadowParent(this, value); // it could be that the parentNode is the shadowRoot, in which case
1141
+ const parentNode = getShadowParent(this, value);
1142
+ // it could be that the parentNode is the shadowRoot, in which case
1197
1143
  // we need to return null.
1198
1144
  // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1199
-
1200
1145
  return parentNode instanceof Element ? parentNode : null;
1201
1146
  }
1202
-
1203
1147
  function compareDocumentPositionPatched(otherNode) {
1204
1148
  if (this === otherNode) {
1205
1149
  return 0;
@@ -1209,71 +1153,56 @@
1209
1153
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
1210
1154
  // "this" and "otherNode" belongs to 2 different shadow tree.
1211
1155
  return 35; // Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING
1212
- } // Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
1156
+ }
1157
+ // Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
1213
1158
  // Node.compareDocumentPosition implementation.
1214
-
1215
-
1216
1159
  return compareDocumentPosition.call(this, otherNode);
1217
1160
  }
1218
-
1219
1161
  function containsPatched(otherNode) {
1220
1162
  if (otherNode == null || getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
1221
1163
  // it is from another shadow
1222
1164
  return false;
1223
1165
  }
1224
-
1225
1166
  return (compareDocumentPosition.call(this, otherNode) & DOCUMENT_POSITION_CONTAINED_BY) !== 0;
1226
1167
  }
1227
-
1228
1168
  function cloneNodePatched(deep) {
1229
- const clone = cloneNode.call(this, false); // Per spec, browsers only care about truthy values
1169
+ const clone = cloneNode.call(this, false);
1170
+ // Per spec, browsers only care about truthy values
1230
1171
  // Not strict true or false
1231
-
1232
1172
  if (!deep) {
1233
1173
  return clone;
1234
1174
  }
1235
-
1236
1175
  const childNodes = getInternalChildNodes(this);
1237
-
1238
1176
  for (let i = 0, len = childNodes.length; i < len; i += 1) {
1239
1177
  clone.appendChild(childNodes[i].cloneNode(true));
1240
1178
  }
1241
-
1242
1179
  return clone;
1243
1180
  }
1244
1181
  /**
1245
1182
  * This method only applies to elements with a shadow or slots
1246
1183
  */
1247
-
1248
-
1249
1184
  function childNodesGetterPatched() {
1250
1185
  if (isSyntheticShadowHost(this)) {
1251
1186
  const owner = getNodeOwner(this);
1252
1187
  const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1253
-
1254
1188
  return createStaticNodeList(childNodes);
1255
- } // nothing to do here since this does not have a synthetic shadow attached to it
1189
+ }
1190
+ // nothing to do here since this does not have a synthetic shadow attached to it
1256
1191
  // TODO [#1636]: what about slot elements?
1257
-
1258
-
1259
1192
  return childNodesGetter.call(this);
1260
1193
  }
1261
-
1262
1194
  const nativeGetRootNode = _Node.prototype.getRootNode;
1263
1195
  /**
1264
1196
  * Get the root by climbing up the dom tree, beyond the shadow root
1265
1197
  * If Node.prototype.getRootNode is supported, use it
1266
1198
  * else, assume we are working in non-native shadow mode and climb using parentNode
1267
1199
  */
1268
-
1269
1200
  const getDocumentOrRootNode = !isUndefined(nativeGetRootNode) ? nativeGetRootNode : function () {
1270
1201
  let node = this;
1271
1202
  let nodeParent;
1272
-
1273
1203
  while (!isNull(nodeParent = parentNodeGetter.call(node))) {
1274
1204
  node = nodeParent;
1275
1205
  }
1276
-
1277
1206
  return node;
1278
1207
  };
1279
1208
  /**
@@ -1285,15 +1214,12 @@
1285
1214
  * of a native shadow or the synthetic shadow.
1286
1215
  * @param {Node} node
1287
1216
  */
1288
-
1289
1217
  function getNearestRoot(node) {
1290
1218
  const ownerNode = getNodeOwner(node);
1291
-
1292
1219
  if (isNull(ownerNode)) {
1293
1220
  // we hit a wall, either we are in native shadow mode or the node is not in lwc boundary.
1294
1221
  return getDocumentOrRootNode.call(node);
1295
1222
  }
1296
-
1297
1223
  return getShadowRoot(ownerNode);
1298
1224
  }
1299
1225
  /**
@@ -1315,25 +1241,20 @@
1315
1241
  * _Spec_: https://dom.spec.whatwg.org/#dom-node-getrootnode
1316
1242
  *
1317
1243
  **/
1318
-
1319
-
1320
1244
  function getRootNodePatched(options) {
1321
1245
  const composed = isUndefined(options) ? false : !!options.composed;
1322
1246
  return isTrue(composed) ? getDocumentOrRootNode.call(this, options) : getNearestRoot(this);
1323
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
1247
+ }
1248
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
1324
1249
  // do not give access to nodes beyond the immediate children.
1325
-
1326
-
1327
1250
  defineProperties(_Node.prototype, {
1328
1251
  firstChild: {
1329
1252
  get() {
1330
1253
  if (hasMountedChildren(this)) {
1331
1254
  return firstChildGetterPatched.call(this);
1332
1255
  }
1333
-
1334
1256
  return firstChildGetter.call(this);
1335
1257
  },
1336
-
1337
1258
  enumerable: true,
1338
1259
  configurable: true
1339
1260
  },
@@ -1342,10 +1263,8 @@
1342
1263
  if (hasMountedChildren(this)) {
1343
1264
  return lastChildGetterPatched.call(this);
1344
1265
  }
1345
-
1346
1266
  return lastChildGetter.call(this);
1347
1267
  },
1348
-
1349
1268
  enumerable: true,
1350
1269
  configurable: true
1351
1270
  },
@@ -1355,18 +1274,14 @@
1355
1274
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1356
1275
  return textContentGetterPatched.call(this);
1357
1276
  }
1358
-
1359
1277
  return textContentGetter.call(this);
1360
- } // TODO [#1222]: remove global bypass
1361
-
1362
-
1278
+ }
1279
+ // TODO [#1222]: remove global bypass
1363
1280
  if (isGlobalPatchingSkipped(this)) {
1364
1281
  return textContentGetter.call(this);
1365
1282
  }
1366
-
1367
1283
  return textContentGetterPatched.call(this);
1368
1284
  },
1369
-
1370
1285
  set: textContentSetterPatched,
1371
1286
  enumerable: true,
1372
1287
  configurable: true
@@ -1376,17 +1291,14 @@
1376
1291
  if (isNodeShadowed(this)) {
1377
1292
  return parentNodeGetterPatched.call(this);
1378
1293
  }
1379
-
1380
- const parentNode = parentNodeGetter.call(this); // Handle the case where a top level light DOM element is slotted into a synthetic
1294
+ const parentNode = parentNodeGetter.call(this);
1295
+ // Handle the case where a top level light DOM element is slotted into a synthetic
1381
1296
  // shadow slot.
1382
-
1383
1297
  if (!isNull(parentNode) && isSyntheticSlotElement(parentNode)) {
1384
1298
  return getNodeOwner(parentNode);
1385
1299
  }
1386
-
1387
1300
  return parentNode;
1388
1301
  },
1389
-
1390
1302
  enumerable: true,
1391
1303
  configurable: true
1392
1304
  },
@@ -1395,17 +1307,14 @@
1395
1307
  if (isNodeShadowed(this)) {
1396
1308
  return parentElementGetterPatched.call(this);
1397
1309
  }
1398
-
1399
- const parentElement = parentElementGetter.call(this); // Handle the case where a top level light DOM element is slotted into a synthetic
1310
+ const parentElement = parentElementGetter.call(this);
1311
+ // Handle the case where a top level light DOM element is slotted into a synthetic
1400
1312
  // shadow slot.
1401
-
1402
1313
  if (!isNull(parentElement) && isSyntheticSlotElement(parentElement)) {
1403
1314
  return getNodeOwner(parentElement);
1404
1315
  }
1405
-
1406
1316
  return parentElement;
1407
1317
  },
1408
-
1409
1318
  enumerable: true,
1410
1319
  configurable: true
1411
1320
  },
@@ -1414,10 +1323,8 @@
1414
1323
  if (hasMountedChildren(this)) {
1415
1324
  return childNodesGetterPatched.call(this);
1416
1325
  }
1417
-
1418
1326
  return childNodesGetter.call(this);
1419
1327
  },
1420
-
1421
1328
  enumerable: true,
1422
1329
  configurable: true
1423
1330
  },
@@ -1426,10 +1333,8 @@
1426
1333
  if (hasMountedChildren(this)) {
1427
1334
  return hasChildNodesPatched.call(this);
1428
1335
  }
1429
-
1430
1336
  return hasChildNodes.call(this);
1431
1337
  },
1432
-
1433
1338
  enumerable: true,
1434
1339
  writable: true,
1435
1340
  configurable: true
@@ -1440,10 +1345,8 @@
1440
1345
  if (isGlobalPatchingSkipped(this)) {
1441
1346
  return compareDocumentPosition.call(this, otherNode);
1442
1347
  }
1443
-
1444
1348
  return compareDocumentPositionPatched.call(this, otherNode);
1445
1349
  },
1446
-
1447
1350
  enumerable: true,
1448
1351
  writable: true,
1449
1352
  configurable: true
@@ -1457,27 +1360,21 @@
1457
1360
  if (this === otherNode) {
1458
1361
  return true;
1459
1362
  }
1460
-
1461
1363
  if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1462
1364
  if (otherNode == null) {
1463
1365
  return false;
1464
1366
  }
1465
-
1466
1367
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1467
1368
  return containsPatched.call(this, otherNode);
1468
1369
  }
1469
-
1470
1370
  return contains.call(this, otherNode);
1471
- } // TODO [#1222]: remove global bypass
1472
-
1473
-
1371
+ }
1372
+ // TODO [#1222]: remove global bypass
1474
1373
  if (isGlobalPatchingSkipped(this)) {
1475
1374
  return contains.call(this, otherNode);
1476
1375
  }
1477
-
1478
1376
  return containsPatched.call(this, otherNode);
1479
1377
  },
1480
-
1481
1378
  enumerable: true,
1482
1379
  writable: true,
1483
1380
  configurable: true
@@ -1488,22 +1385,17 @@
1488
1385
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1489
1386
  return cloneNodePatched.call(this, deep);
1490
1387
  }
1491
-
1492
1388
  return cloneNode.call(this, deep);
1493
1389
  }
1494
-
1495
1390
  if (isTrue(deep)) {
1496
1391
  // TODO [#1222]: remove global bypass
1497
1392
  if (isGlobalPatchingSkipped(this)) {
1498
1393
  return cloneNode.call(this, deep);
1499
1394
  }
1500
-
1501
1395
  return cloneNodePatched.call(this, deep);
1502
1396
  }
1503
-
1504
1397
  return cloneNode.call(this, deep);
1505
1398
  },
1506
-
1507
1399
  enumerable: true,
1508
1400
  writable: true,
1509
1401
  configurable: true
@@ -1517,21 +1409,18 @@
1517
1409
  isConnected: {
1518
1410
  enumerable: true,
1519
1411
  configurable: true,
1520
-
1521
1412
  get() {
1522
1413
  return isConnected.call(this);
1523
1414
  }
1524
-
1525
1415
  }
1526
1416
  });
1527
1417
  const getInternalChildNodes = function (node) {
1528
1418
  return node.childNodes;
1529
- }; // IE11 extra patches for wrong prototypes
1530
-
1419
+ };
1420
+ // IE11 extra patches for wrong prototypes
1531
1421
  if (hasOwnProperty.call(HTMLElement.prototype, 'contains')) {
1532
1422
  defineProperty(HTMLElement.prototype, 'contains', getOwnPropertyDescriptor(_Node.prototype, 'contains'));
1533
1423
  }
1534
-
1535
1424
  if (hasOwnProperty.call(HTMLElement.prototype, 'parentElement')) {
1536
1425
  defineProperty(HTMLElement.prototype, 'parentElement', getOwnPropertyDescriptor(_Node.prototype, 'parentElement'));
1537
1426
  }
@@ -3638,66 +3527,52 @@
3638
3527
  * SPDX-License-Identifier: MIT
3639
3528
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3640
3529
  */
3641
-
3642
3530
  function innerHTMLGetterPatched() {
3643
3531
  const childNodes = getInternalChildNodes(this);
3644
3532
  let innerHTML = '';
3645
-
3646
3533
  for (let i = 0, len = childNodes.length; i < len; i += 1) {
3647
3534
  innerHTML += getOuterHTML(childNodes[i]);
3648
3535
  }
3649
-
3650
3536
  return innerHTML;
3651
3537
  }
3652
-
3653
3538
  function outerHTMLGetterPatched() {
3654
3539
  return getOuterHTML(this);
3655
3540
  }
3656
-
3657
3541
  function attachShadowPatched(options) {
3658
3542
  // To retain native behavior of the API, provide synthetic shadowRoot only when specified
3659
3543
  if (options[KEY__SYNTHETIC_MODE]) {
3660
3544
  return attachShadow(this, options);
3661
3545
  }
3662
-
3663
3546
  return attachShadow$1.call(this, options);
3664
3547
  }
3665
-
3666
3548
  function shadowRootGetterPatched() {
3667
3549
  if (isSyntheticShadowHost(this)) {
3668
3550
  const shadow = getShadowRoot(this);
3669
-
3670
3551
  if (shadow.mode === 'open') {
3671
3552
  return shadow;
3672
3553
  }
3673
3554
  }
3674
-
3675
3555
  return shadowRootGetter.call(this);
3676
3556
  }
3677
-
3678
3557
  function childrenGetterPatched() {
3679
3558
  const owner = getNodeOwner(this);
3680
3559
  const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
3681
3560
  return createStaticHTMLCollection(ArrayFilter.call(childNodes, node => node instanceof Element));
3682
3561
  }
3683
-
3684
3562
  function childElementCountGetterPatched() {
3685
3563
  return this.children.length;
3686
3564
  }
3687
-
3688
3565
  function firstElementChildGetterPatched() {
3689
3566
  return this.children[0] || null;
3690
3567
  }
3691
-
3692
3568
  function lastElementChildGetterPatched() {
3693
3569
  const {
3694
3570
  children
3695
3571
  } = this;
3696
3572
  return children.item(children.length - 1) || null;
3697
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
3573
+ }
3574
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
3698
3575
  // do not five access to nodes beyond the immediate children.
3699
-
3700
-
3701
3576
  defineProperties(Element.prototype, {
3702
3577
  innerHTML: {
3703
3578
  get() {
@@ -3705,22 +3580,17 @@
3705
3580
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3706
3581
  return innerHTMLGetterPatched.call(this);
3707
3582
  }
3708
-
3709
3583
  return innerHTMLGetter.call(this);
3710
- } // TODO [#1222]: remove global bypass
3711
-
3712
-
3584
+ }
3585
+ // TODO [#1222]: remove global bypass
3713
3586
  if (isGlobalPatchingSkipped(this)) {
3714
3587
  return innerHTMLGetter.call(this);
3715
3588
  }
3716
-
3717
3589
  return innerHTMLGetterPatched.call(this);
3718
3590
  },
3719
-
3720
3591
  set(v) {
3721
3592
  innerHTMLSetter.call(this, v);
3722
3593
  },
3723
-
3724
3594
  enumerable: true,
3725
3595
  configurable: true
3726
3596
  },
@@ -3730,22 +3600,17 @@
3730
3600
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
3731
3601
  return outerHTMLGetterPatched.call(this);
3732
3602
  }
3733
-
3734
3603
  return outerHTMLGetter.call(this);
3735
- } // TODO [#1222]: remove global bypass
3736
-
3737
-
3604
+ }
3605
+ // TODO [#1222]: remove global bypass
3738
3606
  if (isGlobalPatchingSkipped(this)) {
3739
3607
  return outerHTMLGetter.call(this);
3740
3608
  }
3741
-
3742
3609
  return outerHTMLGetterPatched.call(this);
3743
3610
  },
3744
-
3745
3611
  set(v) {
3746
3612
  outerHTMLSetter.call(this, v);
3747
3613
  },
3748
-
3749
3614
  enumerable: true,
3750
3615
  configurable: true
3751
3616
  },
@@ -3766,10 +3631,8 @@
3766
3631
  if (hasMountedChildren(this)) {
3767
3632
  return childrenGetterPatched.call(this);
3768
3633
  }
3769
-
3770
3634
  return childrenGetter.call(this);
3771
3635
  },
3772
-
3773
3636
  enumerable: true,
3774
3637
  configurable: true
3775
3638
  },
@@ -3778,10 +3641,8 @@
3778
3641
  if (hasMountedChildren(this)) {
3779
3642
  return childElementCountGetterPatched.call(this);
3780
3643
  }
3781
-
3782
3644
  return childElementCountGetter.call(this);
3783
3645
  },
3784
-
3785
3646
  enumerable: true,
3786
3647
  configurable: true
3787
3648
  },
@@ -3790,10 +3651,8 @@
3790
3651
  if (hasMountedChildren(this)) {
3791
3652
  return firstElementChildGetterPatched.call(this);
3792
3653
  }
3793
-
3794
3654
  return firstElementChildGetter.call(this);
3795
3655
  },
3796
-
3797
3656
  enumerable: true,
3798
3657
  configurable: true
3799
3658
  },
@@ -3802,10 +3661,8 @@
3802
3661
  if (hasMountedChildren(this)) {
3803
3662
  return lastElementChildGetterPatched.call(this);
3804
3663
  }
3805
-
3806
3664
  return lastElementChildGetter.call(this);
3807
3665
  },
3808
-
3809
3666
  enumerable: true,
3810
3667
  configurable: true
3811
3668
  },
@@ -3814,28 +3671,23 @@
3814
3671
  enumerable: true,
3815
3672
  configurable: true
3816
3673
  }
3817
- }); // IE11 extra patches for wrong prototypes
3818
-
3674
+ });
3675
+ // IE11 extra patches for wrong prototypes
3819
3676
  if (hasOwnProperty.call(HTMLElement.prototype, 'innerHTML')) {
3820
3677
  defineProperty(HTMLElement.prototype, 'innerHTML', getOwnPropertyDescriptor(Element.prototype, 'innerHTML'));
3821
3678
  }
3822
-
3823
3679
  if (hasOwnProperty.call(HTMLElement.prototype, 'outerHTML')) {
3824
3680
  defineProperty(HTMLElement.prototype, 'outerHTML', getOwnPropertyDescriptor(Element.prototype, 'outerHTML'));
3825
3681
  }
3826
-
3827
3682
  if (hasOwnProperty.call(HTMLElement.prototype, 'children')) {
3828
3683
  defineProperty(HTMLElement.prototype, 'children', getOwnPropertyDescriptor(Element.prototype, 'children'));
3829
- } // Deep-traversing patches from this point on:
3830
-
3831
-
3684
+ }
3685
+ // Deep-traversing patches from this point on:
3832
3686
  function querySelectorPatched() {
3833
3687
  const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
3834
-
3835
3688
  if (isSyntheticShadowHost(this)) {
3836
3689
  // element with shadowRoot attached
3837
3690
  const owner = getNodeOwner(this);
3838
-
3839
3691
  if (!isUndefined(getNodeKey(this))) {
3840
3692
  // it is a custom element, and we should then filter by slotted elements
3841
3693
  return getFirstSlottedMatch(this, nodeList);
@@ -3848,7 +3700,6 @@
3848
3700
  } else if (isNodeShadowed(this)) {
3849
3701
  // element inside a shadowRoot
3850
3702
  const ownerKey = getNodeOwnerKey(this);
3851
-
3852
3703
  if (!isUndefined(ownerKey)) {
3853
3704
  // `this` is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
3854
3705
  const elm = ArrayFind.call(nodeList, elm => getNodeNearestOwnerKey(elm) === ownerKey);
@@ -3857,10 +3708,9 @@
3857
3708
  if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3858
3709
  // `this` is a manually inserted element inside a shadowRoot, return the first element.
3859
3710
  return nodeList.length === 0 ? null : nodeList[0];
3860
- } // Element is inside a shadow but we dont know which one. Use the
3711
+ }
3712
+ // Element is inside a shadow but we dont know which one. Use the
3861
3713
  // "nearest" owner key to filter by ownership.
3862
-
3863
-
3864
3714
  const contextNearestOwnerKey = getNodeNearestOwnerKey(this);
3865
3715
  const elm = ArrayFind.call(nodeList, elm => getNodeNearestOwnerKey(elm) === contextNearestOwnerKey);
3866
3716
  return isUndefined(elm) ? null : elm;
@@ -3871,22 +3721,19 @@
3871
3721
  const elm = nodeList[0];
3872
3722
  return isUndefined(elm) ? null : elm;
3873
3723
  }
3874
- } // element belonging to the document
3875
-
3876
-
3877
- const elm = ArrayFind.call(nodeList, // TODO [#1222]: remove global bypass
3724
+ }
3725
+ // element belonging to the document
3726
+ const elm = ArrayFind.call(nodeList,
3727
+ // TODO [#1222]: remove global bypass
3878
3728
  elm => isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(this));
3879
3729
  return isUndefined(elm) ? null : elm;
3880
3730
  }
3881
3731
  }
3882
-
3883
3732
  function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
3884
3733
  let filtered;
3885
-
3886
3734
  if (isSyntheticShadowHost(context)) {
3887
3735
  // element with shadowRoot attached
3888
3736
  const owner = getNodeOwner(context);
3889
-
3890
3737
  if (!isUndefined(getNodeKey(context))) {
3891
3738
  // it is a custom element, and we should then filter by slotted elements
3892
3739
  filtered = getAllSlottedMatches(context, unfilteredNodes);
@@ -3899,13 +3746,10 @@
3899
3746
  } else if (isNodeShadowed(context)) {
3900
3747
  // element inside a shadowRoot
3901
3748
  const ownerKey = getNodeOwnerKey(context);
3902
-
3903
3749
  if (!isUndefined(ownerKey)) {
3904
3750
  // context is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
3905
3751
  filtered = ArrayFilter.call(unfilteredNodes, elm => getNodeNearestOwnerKey(elm) === ownerKey);
3906
- } else if (shadowDomSemantic === 1
3907
- /* ShadowDomSemantic.Enabled */
3908
- ) {
3752
+ } else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
3909
3753
  // context is inside a shadow, we dont know which one.
3910
3754
  const contextNearestOwnerKey = getNodeNearestOwnerKey(context);
3911
3755
  filtered = ArrayFilter.call(unfilteredNodes, elm => getNodeNearestOwnerKey(elm) === contextNearestOwnerKey);
@@ -3914,20 +3758,19 @@
3914
3758
  filtered = ArraySlice.call(unfilteredNodes);
3915
3759
  }
3916
3760
  } else {
3917
- if (context instanceof HTMLBodyElement || shadowDomSemantic === 1
3918
- /* ShadowDomSemantic.Enabled */
3919
- ) {
3761
+ if (context instanceof HTMLBodyElement || shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
3920
3762
  // `context` is document.body or element belonging to the document with the patch enabled
3921
- filtered = ArrayFilter.call(unfilteredNodes, // TODO [#1222]: remove global bypass
3763
+ filtered = ArrayFilter.call(unfilteredNodes,
3764
+ // TODO [#1222]: remove global bypass
3922
3765
  elm => isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context));
3923
3766
  } else {
3924
3767
  // `context` is outside the lwc boundary and patch is not enabled.
3925
3768
  filtered = ArraySlice.call(unfilteredNodes);
3926
3769
  }
3927
3770
  }
3928
-
3929
3771
  return filtered;
3930
- } // The following patched methods hide shadowed elements from global
3772
+ }
3773
+ // The following patched methods hide shadowed elements from global
3931
3774
  // traversing mechanisms. They are simplified for performance reasons to
3932
3775
  // filter by ownership and do not account for slotted elements. This
3933
3776
  // compromise is fine for our synthetic shadow dom because root elements
@@ -3936,8 +3779,6 @@
3936
3779
  // static HTMLCollection or static NodeList. We decided that this compromise
3937
3780
  // is not a big problem considering the amount of code that is relying on
3938
3781
  // the liveliness of these results are rare.
3939
-
3940
-
3941
3782
  defineProperties(Element.prototype, {
3942
3783
  querySelector: {
3943
3784
  value: querySelectorPatched,
@@ -3948,41 +3789,30 @@
3948
3789
  querySelectorAll: {
3949
3790
  value() {
3950
3791
  const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
3951
-
3952
3792
  if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
3953
- const filteredResults = getFilteredArrayOfNodes(this, nodeList, 0
3954
- /* ShadowDomSemantic.Disabled */
3955
- );
3793
+ const filteredResults = getFilteredArrayOfNodes(this, nodeList, 0 /* ShadowDomSemantic.Disabled */);
3956
3794
  return createStaticNodeList(filteredResults);
3957
3795
  }
3958
-
3959
- return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1
3960
- /* ShadowDomSemantic.Enabled */
3961
- ));
3796
+ return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
3962
3797
  },
3963
3798
 
3964
3799
  writable: true,
3965
3800
  enumerable: true,
3966
3801
  configurable: true
3967
3802
  }
3968
- }); // The following APIs are used directly by Jest internally so we avoid patching them during testing.
3969
-
3803
+ });
3804
+ // The following APIs are used directly by Jest internally so we avoid patching them during testing.
3970
3805
  {
3971
3806
  defineProperties(Element.prototype, {
3972
3807
  getElementsByClassName: {
3973
3808
  value() {
3974
3809
  const elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
3975
-
3976
3810
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3977
3811
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3978
3812
  }
3979
-
3980
- const filteredResults = getFilteredArrayOfNodes(this, elements, 1
3981
- /* ShadowDomSemantic.Enabled */
3982
- );
3813
+ const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
3983
3814
  return createStaticHTMLCollection(filteredResults);
3984
3815
  },
3985
-
3986
3816
  writable: true,
3987
3817
  enumerable: true,
3988
3818
  configurable: true
@@ -3990,17 +3820,12 @@
3990
3820
  getElementsByTagName: {
3991
3821
  value() {
3992
3822
  const elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
3993
-
3994
3823
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
3995
3824
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
3996
3825
  }
3997
-
3998
- const filteredResults = getFilteredArrayOfNodes(this, elements, 1
3999
- /* ShadowDomSemantic.Enabled */
4000
- );
3826
+ const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4001
3827
  return createStaticHTMLCollection(filteredResults);
4002
3828
  },
4003
-
4004
3829
  writable: true,
4005
3830
  enumerable: true,
4006
3831
  configurable: true
@@ -4008,25 +3833,19 @@
4008
3833
  getElementsByTagNameNS: {
4009
3834
  value() {
4010
3835
  const elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
4011
-
4012
3836
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4013
3837
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4014
3838
  }
4015
-
4016
- const filteredResults = getFilteredArrayOfNodes(this, elements, 1
4017
- /* ShadowDomSemantic.Enabled */
4018
- );
3839
+ const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4019
3840
  return createStaticHTMLCollection(filteredResults);
4020
3841
  },
4021
-
4022
3842
  writable: true,
4023
3843
  enumerable: true,
4024
3844
  configurable: true
4025
3845
  }
4026
3846
  });
4027
- } // IE11 extra patches for wrong prototypes
4028
-
4029
-
3847
+ }
3848
+ // IE11 extra patches for wrong prototypes
4030
3849
  if (hasOwnProperty.call(HTMLElement.prototype, 'getElementsByClassName')) {
4031
3850
  defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
4032
3851
  }
@@ -4565,21 +4384,17 @@
4565
4384
  /**
4566
4385
  * This method only applies to elements with a shadow attached to them
4567
4386
  */
4568
-
4569
4387
  function tabIndexGetterPatched() {
4570
4388
  if (isDelegatingFocus(this) && isFalse(hasAttribute.call(this, 'tabindex'))) {
4571
4389
  // this covers the case where the default tabindex should be 0 because the
4572
4390
  // custom element is delegating its focus
4573
4391
  return 0;
4574
4392
  }
4575
-
4576
4393
  return tabIndexGetter.call(this);
4577
4394
  }
4578
4395
  /**
4579
4396
  * This method only applies to elements with a shadow attached to them
4580
4397
  */
4581
-
4582
-
4583
4398
  function tabIndexSetterPatched(value) {
4584
4399
  // This tabIndex setter might be confusing unless it is understood that HTML
4585
4400
  // elements have default tabIndex property values. Natively focusable elements have
@@ -4587,53 +4402,48 @@
4587
4402
  // value of -1. For example, the tabIndex property value is -1 for both <x-foo> and
4588
4403
  // <x-foo tabindex="-1">, but our delegatesFocus polyfill should only kick in for
4589
4404
  // the latter case when the value of the tabindex attribute is -1.
4590
- const delegatesFocus = isDelegatingFocus(this); // Record the state of things before invoking component setter.
4591
-
4405
+ const delegatesFocus = isDelegatingFocus(this);
4406
+ // Record the state of things before invoking component setter.
4592
4407
  const prevValue = tabIndexGetter.call(this);
4593
4408
  const prevHasAttr = hasAttribute.call(this, 'tabindex');
4594
- tabIndexSetter.call(this, value); // Record the state of things after invoking component setter.
4595
-
4409
+ tabIndexSetter.call(this, value);
4410
+ // Record the state of things after invoking component setter.
4596
4411
  const currValue = tabIndexGetter.call(this);
4597
4412
  const currHasAttr = hasAttribute.call(this, 'tabindex');
4598
- const didValueChange = prevValue !== currValue; // If the tabindex attribute is initially rendered, we can assume that this setter has
4413
+ const didValueChange = prevValue !== currValue;
4414
+ // If the tabindex attribute is initially rendered, we can assume that this setter has
4599
4415
  // previously executed and a listener has been added. We must remove that listener if
4600
4416
  // the tabIndex property value has changed or if the component no longer renders a
4601
4417
  // tabindex attribute.
4602
-
4603
4418
  if (prevHasAttr && (didValueChange || isFalse(currHasAttr))) {
4604
4419
  if (prevValue === -1) {
4605
4420
  ignoreFocusIn(this);
4606
4421
  }
4607
-
4608
4422
  if (prevValue === 0 && delegatesFocus) {
4609
4423
  ignoreFocus(this);
4610
4424
  }
4611
- } // If a tabindex attribute was not rendered after invoking its setter, it means the
4425
+ }
4426
+ // If a tabindex attribute was not rendered after invoking its setter, it means the
4612
4427
  // component is taking control. Do nothing.
4613
-
4614
-
4615
4428
  if (isFalse(currHasAttr)) {
4616
4429
  return;
4617
- } // If the tabindex attribute is initially rendered, we can assume that this setter has
4430
+ }
4431
+ // If the tabindex attribute is initially rendered, we can assume that this setter has
4618
4432
  // previously executed and a listener has been added. If the tabindex attribute is still
4619
4433
  // rendered after invoking the setter AND the tabIndex property value has not changed,
4620
4434
  // we don't need to do any work.
4621
-
4622
-
4623
4435
  if (prevHasAttr && currHasAttr && isFalse(didValueChange)) {
4624
4436
  return;
4625
- } // At this point we know that a tabindex attribute was rendered after invoking the
4437
+ }
4438
+ // At this point we know that a tabindex attribute was rendered after invoking the
4626
4439
  // setter and that either:
4627
4440
  // 1) This is the first time this setter is being invoked.
4628
4441
  // 2) This is not the first time this setter is being invoked and the value is changing.
4629
4442
  // We need to add the appropriate listeners in either case.
4630
-
4631
-
4632
4443
  if (currValue === -1) {
4633
4444
  // Add the magic to skip the shadow tree
4634
4445
  handleFocusIn(this);
4635
4446
  }
4636
-
4637
4447
  if (currValue === 0 && delegatesFocus) {
4638
4448
  // Add the magic to skip the host element
4639
4449
  handleFocus(this);
@@ -4642,64 +4452,52 @@
4642
4452
  /**
4643
4453
  * This method only applies to elements with a shadow attached to them
4644
4454
  */
4645
-
4646
-
4647
4455
  function blurPatched() {
4648
4456
  if (isDelegatingFocus(this)) {
4649
4457
  const currentActiveElement = getActiveElement(this);
4650
-
4651
4458
  if (!isNull(currentActiveElement)) {
4652
4459
  // if there is an active element, blur it (intentionally using the dot notation in case the user defines the blur routine)
4653
4460
  currentActiveElement.blur();
4654
4461
  return;
4655
4462
  }
4656
4463
  }
4657
-
4658
4464
  return blur.call(this);
4659
4465
  }
4660
-
4661
4466
  function focusPatched() {
4662
4467
  // Save enabled state
4663
- const originallyEnabled = isKeyboardFocusNavigationRoutineEnabled(); // Change state by disabling if originally enabled
4664
-
4468
+ const originallyEnabled = isKeyboardFocusNavigationRoutineEnabled();
4469
+ // Change state by disabling if originally enabled
4665
4470
  if (originallyEnabled) {
4666
4471
  disableKeyboardFocusNavigationRoutines();
4667
4472
  }
4668
-
4669
4473
  if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
4670
4474
  hostElementFocus.call(this);
4671
4475
  return;
4672
- } // Typescript does not like it when you treat the `arguments` object as an array
4476
+ }
4477
+ // Typescript does not like it when you treat the `arguments` object as an array
4673
4478
  // @ts-ignore type-mismatch
4674
-
4675
-
4676
- focus.apply(this, arguments); // Restore state by enabling if originally enabled
4677
-
4479
+ focus.apply(this, arguments);
4480
+ // Restore state by enabling if originally enabled
4678
4481
  if (originallyEnabled) {
4679
4482
  enableKeyboardFocusNavigationRoutines();
4680
4483
  }
4681
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
4484
+ }
4485
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
4682
4486
  // do not five access to nodes beyond the immediate children.
4683
-
4684
-
4685
4487
  defineProperties(HTMLElement.prototype, {
4686
4488
  tabIndex: {
4687
4489
  get() {
4688
4490
  if (isSyntheticShadowHost(this)) {
4689
4491
  return tabIndexGetterPatched.call(this);
4690
4492
  }
4691
-
4692
4493
  return tabIndexGetter.call(this);
4693
4494
  },
4694
-
4695
4495
  set(v) {
4696
4496
  if (isSyntheticShadowHost(this)) {
4697
4497
  return tabIndexSetterPatched.call(this, v);
4698
4498
  }
4699
-
4700
4499
  return tabIndexSetter.call(this, v);
4701
4500
  },
4702
-
4703
4501
  enumerable: true,
4704
4502
  configurable: true
4705
4503
  },
@@ -4708,10 +4506,8 @@
4708
4506
  if (isSyntheticShadowHost(this)) {
4709
4507
  return blurPatched.call(this);
4710
4508
  }
4711
-
4712
4509
  blur.call(this);
4713
4510
  },
4714
-
4715
4511
  enumerable: true,
4716
4512
  writable: true,
4717
4513
  configurable: true
@@ -4722,46 +4518,38 @@
4722
4518
  // @ts-ignore type-mismatch
4723
4519
  focusPatched.apply(this, arguments);
4724
4520
  },
4725
-
4726
4521
  enumerable: true,
4727
4522
  writable: true,
4728
4523
  configurable: true
4729
4524
  }
4730
- }); // Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
4731
-
4525
+ });
4526
+ // Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
4732
4527
  if (innerTextGetter !== null && innerTextSetter !== null) {
4733
4528
  defineProperty(HTMLElement.prototype, 'innerText', {
4734
4529
  get() {
4735
4530
  if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4736
4531
  return innerTextGetter.call(this);
4737
4532
  }
4738
-
4739
4533
  if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4740
4534
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4741
4535
  return getInnerText(this);
4742
4536
  }
4743
-
4744
4537
  return innerTextGetter.call(this);
4745
- } // TODO [#1222]: remove global bypass
4746
-
4747
-
4538
+ }
4539
+ // TODO [#1222]: remove global bypass
4748
4540
  if (isGlobalPatchingSkipped(this)) {
4749
4541
  return innerTextGetter.call(this);
4750
4542
  }
4751
-
4752
4543
  return getInnerText(this);
4753
4544
  },
4754
-
4755
4545
  set(v) {
4756
4546
  innerTextSetter.call(this, v);
4757
4547
  },
4758
-
4759
4548
  enumerable: true,
4760
4549
  configurable: true
4761
4550
  });
4762
- } // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
4763
-
4764
-
4551
+ }
4552
+ // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
4765
4553
  if (outerTextGetter !== null && outerTextSetter !== null) {
4766
4554
  // From https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText :
4767
4555
  // HTMLElement.outerText is a non-standard property. As a getter, it returns the same value as Node.innerText.
@@ -4771,30 +4559,24 @@
4771
4559
  if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
4772
4560
  return outerTextGetter.call(this);
4773
4561
  }
4774
-
4775
4562
  if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
4776
4563
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4777
4564
  return getInnerText(this);
4778
4565
  }
4779
-
4780
4566
  return outerTextGetter.call(this);
4781
- } // TODO [#1222]: remove global bypass
4782
-
4783
-
4567
+ }
4568
+ // TODO [#1222]: remove global bypass
4784
4569
  if (isGlobalPatchingSkipped(this)) {
4785
4570
  return outerTextGetter.call(this);
4786
4571
  }
4787
-
4788
4572
  return getInnerText(this);
4789
4573
  },
4790
-
4791
4574
  set(v) {
4792
4575
  // Invoking the `outerText` setter on a host element should trigger its disconnection, but until we merge node reactions, it will not work.
4793
4576
  // 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))
4794
4577
  // but the benefits don't worth the efforts.
4795
4578
  outerTextSetter.call(this, v);
4796
4579
  },
4797
-
4798
4580
  enumerable: true,
4799
4581
  configurable: true
4800
4582
  });
@@ -4973,6 +4755,6 @@
4973
4755
  },
4974
4756
  configurable: true,
4975
4757
  });
4976
- /** version: 2.29.0 */
4758
+ /** version: 2.30.0 */
4977
4759
 
4978
4760
  }));