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