lwc 2.5.3 → 2.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +151 -101
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +151 -100
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +139 -80
  5. package/dist/engine-dom/iife/es5/engine-dom.js +181 -109
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +167 -87
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +151 -100
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +139 -80
  11. package/dist/engine-dom/umd/es5/engine-dom.js +181 -109
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +167 -87
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +151 -107
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +151 -108
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +46 -40
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +46 -40
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +45 -39
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +46 -40
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +45 -39
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +46 -40
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +45 -39
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +46 -40
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +45 -39
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  41. package/package.json +8 -8
@@ -117,7 +117,7 @@
117
117
  var KEY__SHADOW_TOKEN = '$shadowToken$';
118
118
  var KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
119
119
  var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
120
- /** version: 2.5.3 */
120
+ /** version: 2.5.7 */
121
121
 
122
122
  /*
123
123
  * Copyright (c) 2018, salesforce.com, inc.
@@ -448,7 +448,7 @@
448
448
  }
449
449
 
450
450
  var runtimeFlags = _globalThis.lwcRuntimeFlags;
451
- /** version: 2.5.3 */
451
+ /** version: 2.5.7 */
452
452
 
453
453
  /*
454
454
  * Copyright (c) 2018, salesforce.com, inc.
@@ -546,9 +546,9 @@
546
546
  };
547
547
 
548
548
  function getRootNodeHost(node, options) {
549
- var rootNode = node.getRootNode(options); // is SyntheticShadowRootInterface
549
+ var rootNode = node.getRootNode(options);
550
550
 
551
- if ('mode' in rootNode && 'delegatesFocus' in rootNode) {
551
+ if (isSyntheticShadowRoot(rootNode)) {
552
552
  rootNode = getHost(rootNode);
553
553
  }
554
554
 
@@ -1111,13 +1111,13 @@
1111
1111
  }
1112
1112
 
1113
1113
  function getFilteredChildNodes(node) {
1114
- if (!isHostElement(node) && !isSlotElement(node)) {
1114
+ if (!isSyntheticShadowHost(node) && !isSlotElement(node)) {
1115
1115
  // regular element - fast path
1116
1116
  var children = childNodesGetter.call(node);
1117
1117
  return arrayFromCollection(children);
1118
1118
  }
1119
1119
 
1120
- if (isHostElement(node)) {
1120
+ if (isSyntheticShadowHost(node)) {
1121
1121
  // we need to get only the nodes that were slotted
1122
1122
  var slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
1123
1123
  var resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
@@ -1529,7 +1529,7 @@
1529
1529
 
1530
1530
 
1531
1531
  function hasMountedChildren(node) {
1532
- return isSyntheticSlotElement(node) || isHostElement(node);
1532
+ return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
1533
1533
  }
1534
1534
 
1535
1535
  function getShadowParent(node, value) {
@@ -1650,7 +1650,7 @@
1650
1650
 
1651
1651
 
1652
1652
  function childNodesGetterPatched() {
1653
- if (isHostElement(this)) {
1653
+ if (isSyntheticShadowHost(this)) {
1654
1654
  var owner = getNodeOwner(this);
1655
1655
  var childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1656
1656
 
@@ -1753,7 +1753,7 @@
1753
1753
  textContent: {
1754
1754
  get: function get() {
1755
1755
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
1756
- if (isNodeShadowed(this) || isHostElement(this)) {
1756
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1757
1757
  return textContentGetterPatched.call(this);
1758
1758
  }
1759
1759
 
@@ -1858,7 +1858,7 @@
1858
1858
  return false;
1859
1859
  }
1860
1860
 
1861
- if (isNodeShadowed(this) || isHostElement(this)) {
1861
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1862
1862
  return containsPatched.call(this, otherNode);
1863
1863
  }
1864
1864
 
@@ -1879,7 +1879,7 @@
1879
1879
  cloneNode: {
1880
1880
  value: function value(deep) {
1881
1881
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
1882
- if (isNodeShadowed(this) || isHostElement(this)) {
1882
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1883
1883
  return cloneNodePatched.call(this, deep);
1884
1884
  }
1885
1885
 
@@ -1982,7 +1982,7 @@
1982
1982
  createDocumentFragment = _document.createDocumentFragment;
1983
1983
 
1984
1984
  function hasInternalSlot(root) {
1985
- return Boolean(InternalSlot.get(root));
1985
+ return InternalSlot.has(root);
1986
1986
  }
1987
1987
 
1988
1988
  function getInternalSlot(root) {
@@ -2034,14 +2034,20 @@
2034
2034
  // and we can avoid having to cast the type before calling this method in a few places.
2035
2035
 
2036
2036
 
2037
- function isHostElement(node) {
2038
- return !isUndefined(InternalSlot.get(node));
2037
+ function isSyntheticShadowHost(node) {
2038
+ var shadowRootRecord = InternalSlot.get(node);
2039
+ return !isUndefined(shadowRootRecord) && node === shadowRootRecord.host;
2040
+ }
2041
+
2042
+ function isSyntheticShadowRoot(node) {
2043
+ var shadowRootRecord = InternalSlot.get(node);
2044
+ return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
2039
2045
  }
2040
2046
 
2041
2047
  var uid = 0;
2042
2048
 
2043
2049
  function attachShadow(elm, options) {
2044
- if (!isUndefined(InternalSlot.get(elm))) {
2050
+ if (InternalSlot.has(elm)) {
2045
2051
  throw new Error("Failed to execute 'attachShadow' on 'Element': Shadow root cannot be created on a host which already hosts a shadow tree.");
2046
2052
  }
2047
2053
 
@@ -2545,7 +2551,7 @@
2545
2551
  } else {
2546
2552
  current = current.parentNode;
2547
2553
  }
2548
- } else if ((current instanceof SyntheticShadowRoot || isInstanceOfNativeShadowRoot(current)) && (composed || current !== startRoot)) {
2554
+ } else if ((isSyntheticShadowRoot(current) || isInstanceOfNativeShadowRoot(current)) && (composed || current !== startRoot)) {
2549
2555
  current = current.host;
2550
2556
  } else if (current instanceof _Node) {
2551
2557
  current = current.parentNode;
@@ -2607,7 +2613,7 @@
2607
2613
  lastRoot = root;
2608
2614
  }
2609
2615
 
2610
- if (!(root instanceof SyntheticShadowRoot) || !isUndefined(rootIdx) && rootIdx > -1) {
2616
+ if (!isSyntheticShadowRoot(root) || !isUndefined(rootIdx) && rootIdx > -1) {
2611
2617
  return ancestor;
2612
2618
  }
2613
2619
  }
@@ -3400,10 +3406,10 @@
3400
3406
  if (ArrayIndexOf.call(targetObservers, this) === -1) {
3401
3407
  ArrayPush.call(targetObservers, this);
3402
3408
  } // else There is more bookkeeping to do here https://dom.spec.whatwg.org/#dom-mutationobserver-observe Step #7
3403
- // If the target is a SyntheticShadowRoot, observe the host since the shadowRoot is an empty documentFragment
3409
+ // SyntheticShadowRoot instances are not actually a part of the DOM so observe the host instead.
3404
3410
 
3405
3411
 
3406
- if (target instanceof SyntheticShadowRoot) {
3412
+ if (isSyntheticShadowRoot(target)) {
3407
3413
  target = target.host;
3408
3414
  } // maintain a list of all nodes observed by this observer
3409
3415
 
@@ -3446,7 +3452,7 @@
3446
3452
  */
3447
3453
 
3448
3454
  function patchedAddEventListener$1(type, listener, optionsOrCapture) {
3449
- if (isHostElement(this)) {
3455
+ if (isSyntheticShadowHost(this)) {
3450
3456
  // Typescript does not like it when you treat the `arguments` object as an array
3451
3457
  // @ts-ignore type-mismatch
3452
3458
  return addCustomElementEventListener.apply(this, arguments);
@@ -3474,7 +3480,7 @@
3474
3480
  }
3475
3481
 
3476
3482
  function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
3477
- if (isHostElement(this)) {
3483
+ if (isSyntheticShadowHost(this)) {
3478
3484
  // Typescript does not like it when you treat the `arguments` object as an array
3479
3485
  // @ts-ignore type-mismatch
3480
3486
  return removeCustomElementEventListener.apply(this, arguments);
@@ -3640,7 +3646,7 @@
3640
3646
  var actualCurrentTarget = originalCurrentTarget;
3641
3647
  var actualPath = composedPath; // Address the possibility that `currentTarget` is a shadow root
3642
3648
 
3643
- if (isHostElement(originalCurrentTarget)) {
3649
+ if (isSyntheticShadowHost(originalCurrentTarget)) {
3644
3650
  var context = eventToContextMap.get(this);
3645
3651
 
3646
3652
  if (context === 1
@@ -3651,7 +3657,7 @@
3651
3657
  } // Address the possibility that `target` is a shadow root
3652
3658
 
3653
3659
 
3654
- if (isHostElement(originalTarget) && eventToShadowRootMap.has(this)) {
3660
+ if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
3655
3661
  actualPath = pathComposer(getShadowRoot(originalTarget), this.composed);
3656
3662
  }
3657
3663
 
@@ -3688,7 +3694,7 @@
3688
3694
 
3689
3695
  var actualTarget = originalTarget;
3690
3696
 
3691
- if (isHostElement(originalTarget) && eventToShadowRootMap.has(this)) {
3697
+ if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
3692
3698
  actualTarget = getShadowRoot(originalTarget);
3693
3699
  }
3694
3700
 
@@ -3949,7 +3955,7 @@
3949
3955
  var ownerKey = getNodeOwnerKey(context); // a node inside a shadow.
3950
3956
 
3951
3957
  if (!isUndefined(ownerKey)) {
3952
- if (isHostElement(context)) {
3958
+ if (isSyntheticShadowHost(context)) {
3953
3959
  // element with shadowRoot attached
3954
3960
  var owner = getNodeOwner(context);
3955
3961
 
@@ -4014,7 +4020,7 @@
4014
4020
  }
4015
4021
 
4016
4022
  function shadowRootGetterPatched() {
4017
- if (isHostElement(this)) {
4023
+ if (isSyntheticShadowHost(this)) {
4018
4024
  var shadow = getShadowRoot(this);
4019
4025
 
4020
4026
  if (shadow.mode === 'open') {
@@ -4052,7 +4058,7 @@
4052
4058
  innerHTML: {
4053
4059
  get: function get() {
4054
4060
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4055
- if (isNodeShadowed(this) || isHostElement(this)) {
4061
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4056
4062
  return innerHTMLGetterPatched.call(this);
4057
4063
  }
4058
4064
 
@@ -4075,7 +4081,7 @@
4075
4081
  outerHTML: {
4076
4082
  get: function get() {
4077
4083
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4078
- if (isNodeShadowed(this) || isHostElement(this)) {
4084
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4079
4085
  return outerHTMLGetterPatched.call(this);
4080
4086
  }
4081
4087
 
@@ -4176,7 +4182,7 @@
4176
4182
 
4177
4183
  var nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
4178
4184
 
4179
- if (isHostElement(this)) {
4185
+ if (isSyntheticShadowHost(this)) {
4180
4186
  // element with shadowRoot attached
4181
4187
  var owner = getNodeOwner(this);
4182
4188
 
@@ -4236,7 +4242,7 @@
4236
4242
  function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
4237
4243
  var filtered;
4238
4244
 
4239
- if (isHostElement(context)) {
4245
+ if (isSyntheticShadowHost(context)) {
4240
4246
  // element with shadowRoot attached
4241
4247
  var owner = getNodeOwner(context);
4242
4248
 
@@ -4435,7 +4441,7 @@
4435
4441
 
4436
4442
 
4437
4443
  function isTabbable(element) {
4438
- if (isHostElement(element) && isDelegatingFocus(element)) {
4444
+ if (isSyntheticShadowHost(element) && isDelegatingFocus(element)) {
4439
4445
  return false;
4440
4446
  }
4441
4447
 
@@ -5124,7 +5130,7 @@
5124
5130
  disableKeyboardFocusNavigationRoutines();
5125
5131
  }
5126
5132
 
5127
- if (isHostElement(this) && isDelegatingFocus(this)) {
5133
+ if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
5128
5134
  hostElementFocus.call(this);
5129
5135
  return;
5130
5136
  } // Typescript does not like it when you treat the `arguments` object as an array
@@ -5143,14 +5149,14 @@
5143
5149
  defineProperties(HTMLElement.prototype, {
5144
5150
  tabIndex: {
5145
5151
  get: function get() {
5146
- if (isHostElement(this)) {
5152
+ if (isSyntheticShadowHost(this)) {
5147
5153
  return tabIndexGetterPatched.call(this);
5148
5154
  }
5149
5155
 
5150
5156
  return tabIndexGetter.call(this);
5151
5157
  },
5152
5158
  set: function set(v) {
5153
- if (isHostElement(this)) {
5159
+ if (isSyntheticShadowHost(this)) {
5154
5160
  return tabIndexSetterPatched.call(this, v);
5155
5161
  }
5156
5162
 
@@ -5161,7 +5167,7 @@
5161
5167
  },
5162
5168
  blur: {
5163
5169
  value: function value() {
5164
- if (isHostElement(this)) {
5170
+ if (isSyntheticShadowHost(this)) {
5165
5171
  return blurPatched.call(this);
5166
5172
  }
5167
5173
 
@@ -5191,7 +5197,7 @@
5191
5197
  }
5192
5198
 
5193
5199
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
5194
- if (isNodeShadowed(this) || isHostElement(this)) {
5200
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
5195
5201
  return getInnerText(this);
5196
5202
  }
5197
5203
 
@@ -5225,7 +5231,7 @@
5225
5231
  }
5226
5232
 
5227
5233
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
5228
- if (isNodeShadowed(this) || isHostElement(this)) {
5234
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
5229
5235
  return getInnerText(this);
5230
5236
  }
5231
5237
 
@@ -5326,7 +5332,7 @@
5326
5332
  if (node instanceof Element) {
5327
5333
  setShadowToken(node, shadowToken);
5328
5334
 
5329
- if (isHostElement(node)) {
5335
+ if (isSyntheticShadowHost(node)) {
5330
5336
  // Root LWC elements can't get content slotted into them, therefore we don't observe their children.
5331
5337
  return;
5332
5338
  }
@@ -5429,6 +5435,6 @@
5429
5435
  },
5430
5436
  configurable: true
5431
5437
  });
5432
- /** version: 2.5.3 */
5438
+ /** version: 2.5.7 */
5433
5439
 
5434
5440
  })();
@@ -199,7 +199,7 @@
199
199
  // we can't use typeof since it will fail when transpiling.
200
200
 
201
201
  const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
202
- /** version: 2.5.3 */
202
+ /** version: 2.5.7 */
203
203
 
204
204
  /*
205
205
  * Copyright (c) 2018, salesforce.com, inc.
@@ -538,7 +538,7 @@
538
538
  }
539
539
 
540
540
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
541
- /** version: 2.5.3 */
541
+ /** version: 2.5.7 */
542
542
 
543
543
  /*
544
544
  * Copyright (c) 2018, salesforce.com, inc.
@@ -598,7 +598,7 @@
598
598
  const currentTarget = eventCurrentTargetGetter.call(event);
599
599
 
600
600
  if (process.env.NODE_ENV !== 'production') {
601
- assert.invariant(isFalse(isHostElement(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
601
+ assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
602
602
  }
603
603
 
604
604
  const {
@@ -644,9 +644,9 @@
644
644
  };
645
645
 
646
646
  function getRootNodeHost(node, options) {
647
- let rootNode = node.getRootNode(options); // is SyntheticShadowRootInterface
647
+ let rootNode = node.getRootNode(options);
648
648
 
649
- if ('mode' in rootNode && 'delegatesFocus' in rootNode) {
649
+ if (isSyntheticShadowRoot(rootNode)) {
650
650
  rootNode = getHost(rootNode);
651
651
  }
652
652
 
@@ -1242,13 +1242,13 @@
1242
1242
  }
1243
1243
 
1244
1244
  function getFilteredChildNodes(node) {
1245
- if (!isHostElement(node) && !isSlotElement(node)) {
1245
+ if (!isSyntheticShadowHost(node) && !isSlotElement(node)) {
1246
1246
  // regular element - fast path
1247
1247
  const children = childNodesGetter.call(node);
1248
1248
  return arrayFromCollection(children);
1249
1249
  }
1250
1250
 
1251
- if (isHostElement(node)) {
1251
+ if (isSyntheticShadowHost(node)) {
1252
1252
  // we need to get only the nodes that were slotted
1253
1253
  const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
1254
1254
  const resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
@@ -1690,7 +1690,7 @@
1690
1690
 
1691
1691
 
1692
1692
  function hasMountedChildren(node) {
1693
- return isSyntheticSlotElement(node) || isHostElement(node);
1693
+ return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
1694
1694
  }
1695
1695
 
1696
1696
  function getShadowParent(node, value) {
@@ -1811,7 +1811,7 @@
1811
1811
 
1812
1812
 
1813
1813
  function childNodesGetterPatched() {
1814
- if (isHostElement(this)) {
1814
+ if (isSyntheticShadowHost(this)) {
1815
1815
  const owner = getNodeOwner(this);
1816
1816
  const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1817
1817
 
@@ -1924,7 +1924,7 @@
1924
1924
  textContent: {
1925
1925
  get() {
1926
1926
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
1927
- if (isNodeShadowed(this) || isHostElement(this)) {
1927
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1928
1928
  return textContentGetterPatched.call(this);
1929
1929
  }
1930
1930
 
@@ -2035,7 +2035,7 @@
2035
2035
  return false;
2036
2036
  }
2037
2037
 
2038
- if (isNodeShadowed(this) || isHostElement(this)) {
2038
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
2039
2039
  return containsPatched.call(this, otherNode);
2040
2040
  }
2041
2041
 
@@ -2057,7 +2057,7 @@
2057
2057
  cloneNode: {
2058
2058
  value(deep) {
2059
2059
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
2060
- if (isNodeShadowed(this) || isHostElement(this)) {
2060
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
2061
2061
  return cloneNodePatched.call(this, deep);
2062
2062
  }
2063
2063
 
@@ -2195,7 +2195,7 @@
2195
2195
  } = document;
2196
2196
 
2197
2197
  function hasInternalSlot(root) {
2198
- return Boolean(InternalSlot.get(root));
2198
+ return InternalSlot.has(root);
2199
2199
  }
2200
2200
 
2201
2201
  function getInternalSlot(root) {
@@ -2249,14 +2249,20 @@
2249
2249
  // and we can avoid having to cast the type before calling this method in a few places.
2250
2250
 
2251
2251
 
2252
- function isHostElement(node) {
2253
- return !isUndefined(InternalSlot.get(node));
2252
+ function isSyntheticShadowHost(node) {
2253
+ const shadowRootRecord = InternalSlot.get(node);
2254
+ return !isUndefined(shadowRootRecord) && node === shadowRootRecord.host;
2255
+ }
2256
+
2257
+ function isSyntheticShadowRoot(node) {
2258
+ const shadowRootRecord = InternalSlot.get(node);
2259
+ return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
2254
2260
  }
2255
2261
 
2256
2262
  let uid = 0;
2257
2263
 
2258
2264
  function attachShadow(elm, options) {
2259
- if (!isUndefined(InternalSlot.get(elm))) {
2265
+ if (InternalSlot.has(elm)) {
2260
2266
  throw new Error(`Failed to execute 'attachShadow' on 'Element': Shadow root cannot be created on a host which already hosts a shadow tree.`);
2261
2267
  }
2262
2268
 
@@ -2889,7 +2895,7 @@
2889
2895
  } else {
2890
2896
  current = current.parentNode;
2891
2897
  }
2892
- } else if ((current instanceof SyntheticShadowRoot || isInstanceOfNativeShadowRoot(current)) && (composed || current !== startRoot)) {
2898
+ } else if ((isSyntheticShadowRoot(current) || isInstanceOfNativeShadowRoot(current)) && (composed || current !== startRoot)) {
2893
2899
  current = current.host;
2894
2900
  } else if (current instanceof _Node) {
2895
2901
  current = current.parentNode;
@@ -2951,7 +2957,7 @@
2951
2957
  lastRoot = root;
2952
2958
  }
2953
2959
 
2954
- if (!(root instanceof SyntheticShadowRoot) || !isUndefined(rootIdx) && rootIdx > -1) {
2960
+ if (!isSyntheticShadowRoot(root) || !isUndefined(rootIdx) && rootIdx > -1) {
2955
2961
  return ancestor;
2956
2962
  }
2957
2963
  }
@@ -3762,10 +3768,10 @@
3762
3768
  if (ArrayIndexOf.call(targetObservers, this) === -1) {
3763
3769
  ArrayPush.call(targetObservers, this);
3764
3770
  } // else There is more bookkeeping to do here https://dom.spec.whatwg.org/#dom-mutationobserver-observe Step #7
3765
- // If the target is a SyntheticShadowRoot, observe the host since the shadowRoot is an empty documentFragment
3771
+ // SyntheticShadowRoot instances are not actually a part of the DOM so observe the host instead.
3766
3772
 
3767
3773
 
3768
- if (target instanceof SyntheticShadowRoot) {
3774
+ if (isSyntheticShadowRoot(target)) {
3769
3775
  target = target.host;
3770
3776
  } // maintain a list of all nodes observed by this observer
3771
3777
 
@@ -3808,7 +3814,7 @@
3808
3814
  */
3809
3815
 
3810
3816
  function patchedAddEventListener$1(type, listener, optionsOrCapture) {
3811
- if (isHostElement(this)) {
3817
+ if (isSyntheticShadowHost(this)) {
3812
3818
  // Typescript does not like it when you treat the `arguments` object as an array
3813
3819
  // @ts-ignore type-mismatch
3814
3820
  return addCustomElementEventListener.apply(this, arguments);
@@ -3836,7 +3842,7 @@
3836
3842
  }
3837
3843
 
3838
3844
  function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
3839
- if (isHostElement(this)) {
3845
+ if (isSyntheticShadowHost(this)) {
3840
3846
  // Typescript does not like it when you treat the `arguments` object as an array
3841
3847
  // @ts-ignore type-mismatch
3842
3848
  return removeCustomElementEventListener.apply(this, arguments);
@@ -4002,7 +4008,7 @@
4002
4008
  let actualCurrentTarget = originalCurrentTarget;
4003
4009
  let actualPath = composedPath; // Address the possibility that `currentTarget` is a shadow root
4004
4010
 
4005
- if (isHostElement(originalCurrentTarget)) {
4011
+ if (isSyntheticShadowHost(originalCurrentTarget)) {
4006
4012
  const context = eventToContextMap.get(this);
4007
4013
 
4008
4014
  if (context === 1
@@ -4013,7 +4019,7 @@
4013
4019
  } // Address the possibility that `target` is a shadow root
4014
4020
 
4015
4021
 
4016
- if (isHostElement(originalTarget) && eventToShadowRootMap.has(this)) {
4022
+ if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
4017
4023
  actualPath = pathComposer(getShadowRoot(originalTarget), this.composed);
4018
4024
  }
4019
4025
 
@@ -4050,7 +4056,7 @@
4050
4056
 
4051
4057
  let actualTarget = originalTarget;
4052
4058
 
4053
- if (isHostElement(originalTarget) && eventToShadowRootMap.has(this)) {
4059
+ if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
4054
4060
  actualTarget = getShadowRoot(originalTarget);
4055
4061
  }
4056
4062
 
@@ -4321,7 +4327,7 @@
4321
4327
  const ownerKey = getNodeOwnerKey(context); // a node inside a shadow.
4322
4328
 
4323
4329
  if (!isUndefined(ownerKey)) {
4324
- if (isHostElement(context)) {
4330
+ if (isSyntheticShadowHost(context)) {
4325
4331
  // element with shadowRoot attached
4326
4332
  const owner = getNodeOwner(context);
4327
4333
 
@@ -4382,7 +4388,7 @@
4382
4388
  }
4383
4389
 
4384
4390
  function shadowRootGetterPatched() {
4385
- if (isHostElement(this)) {
4391
+ if (isSyntheticShadowHost(this)) {
4386
4392
  const shadow = getShadowRoot(this);
4387
4393
 
4388
4394
  if (shadow.mode === 'open') {
@@ -4420,7 +4426,7 @@
4420
4426
  innerHTML: {
4421
4427
  get() {
4422
4428
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4423
- if (isNodeShadowed(this) || isHostElement(this)) {
4429
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4424
4430
  return innerHTMLGetterPatched.call(this);
4425
4431
  }
4426
4432
 
@@ -4445,7 +4451,7 @@
4445
4451
  outerHTML: {
4446
4452
  get() {
4447
4453
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4448
- if (isNodeShadowed(this) || isHostElement(this)) {
4454
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4449
4455
  return outerHTMLGetterPatched.call(this);
4450
4456
  }
4451
4457
 
@@ -4550,7 +4556,7 @@
4550
4556
  function querySelectorPatched() {
4551
4557
  const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
4552
4558
 
4553
- if (isHostElement(this)) {
4559
+ if (isSyntheticShadowHost(this)) {
4554
4560
  // element with shadowRoot attached
4555
4561
  const owner = getNodeOwner(this);
4556
4562
 
@@ -4601,7 +4607,7 @@
4601
4607
  function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
4602
4608
  let filtered;
4603
4609
 
4604
- if (isHostElement(context)) {
4610
+ if (isSyntheticShadowHost(context)) {
4605
4611
  // element with shadowRoot attached
4606
4612
  const owner = getNodeOwner(context);
4607
4613
 
@@ -4810,7 +4816,7 @@
4810
4816
 
4811
4817
 
4812
4818
  function isTabbable(element) {
4813
- if (isHostElement(element) && isDelegatingFocus(element)) {
4819
+ if (isSyntheticShadowHost(element) && isDelegatingFocus(element)) {
4814
4820
  return false;
4815
4821
  }
4816
4822
 
@@ -5509,7 +5515,7 @@
5509
5515
  disableKeyboardFocusNavigationRoutines();
5510
5516
  }
5511
5517
 
5512
- if (isHostElement(this) && isDelegatingFocus(this)) {
5518
+ if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
5513
5519
  hostElementFocus.call(this);
5514
5520
  return;
5515
5521
  } // Typescript does not like it when you treat the `arguments` object as an array
@@ -5528,7 +5534,7 @@
5528
5534
  defineProperties(HTMLElement.prototype, {
5529
5535
  tabIndex: {
5530
5536
  get() {
5531
- if (isHostElement(this)) {
5537
+ if (isSyntheticShadowHost(this)) {
5532
5538
  return tabIndexGetterPatched.call(this);
5533
5539
  }
5534
5540
 
@@ -5536,7 +5542,7 @@
5536
5542
  },
5537
5543
 
5538
5544
  set(v) {
5539
- if (isHostElement(this)) {
5545
+ if (isSyntheticShadowHost(this)) {
5540
5546
  return tabIndexSetterPatched.call(this, v);
5541
5547
  }
5542
5548
 
@@ -5548,7 +5554,7 @@
5548
5554
  },
5549
5555
  blur: {
5550
5556
  value() {
5551
- if (isHostElement(this)) {
5557
+ if (isSyntheticShadowHost(this)) {
5552
5558
  return blurPatched.call(this);
5553
5559
  }
5554
5560
 
@@ -5580,7 +5586,7 @@
5580
5586
  }
5581
5587
 
5582
5588
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
5583
- if (isNodeShadowed(this) || isHostElement(this)) {
5589
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
5584
5590
  return getInnerText(this);
5585
5591
  }
5586
5592
 
@@ -5616,7 +5622,7 @@
5616
5622
  }
5617
5623
 
5618
5624
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
5619
- if (isNodeShadowed(this) || isHostElement(this)) {
5625
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
5620
5626
  return getInnerText(this);
5621
5627
  }
5622
5628
 
@@ -5721,7 +5727,7 @@
5721
5727
  if (node instanceof Element) {
5722
5728
  setShadowToken(node, shadowToken);
5723
5729
 
5724
- if (isHostElement(node)) {
5730
+ if (isSyntheticShadowHost(node)) {
5725
5731
  // Root LWC elements can't get content slotted into them, therefore we don't observe their children.
5726
5732
  return;
5727
5733
  }
@@ -5828,6 +5834,6 @@
5828
5834
 
5829
5835
  configurable: true
5830
5836
  });
5831
- /** version: 2.5.3 */
5837
+ /** version: 2.5.7 */
5832
5838
 
5833
5839
  }));