lwc 2.6.2 → 2.6.3

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 +578 -384
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +578 -384
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -9
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +552 -360
  5. package/dist/engine-dom/iife/es5/engine-dom.js +630 -335
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -9
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +598 -311
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +578 -384
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -9
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +552 -360
  11. package/dist/engine-dom/umd/es5/engine-dom.js +630 -335
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -9
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +598 -311
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +647 -454
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -9
  16. package/dist/engine-server/esm/es2017/engine-server.js +647 -454
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +115 -13
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +115 -13
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +115 -13
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +119 -13
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +119 -13
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +115 -13
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +115 -13
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +119 -13
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +119 -13
  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 +3 -3
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +3 -3
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +3 -3
  41. package/package.json +8 -8
@@ -194,7 +194,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
194
194
  // we can't use typeof since it will fail when transpiling.
195
195
 
196
196
  const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
197
- /** version: 2.6.2 */
197
+ /** version: 2.6.3 */
198
198
 
199
199
  /*
200
200
  * Copyright (c) 2018, salesforce.com, inc.
@@ -302,6 +302,7 @@ const {
302
302
  getElementsByClassName: getElementsByClassName$1
303
303
  } = HTMLElement.prototype;
304
304
  const shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : () => null;
305
+ const assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : () => null;
305
306
  /*
306
307
  * Copyright (c) 2018, salesforce.com, inc.
307
308
  * All rights reserved.
@@ -918,6 +919,15 @@ function getNodeKey(node) {
918
919
  function isNodeShadowed(node) {
919
920
  return !isUndefined(getNodeOwnerKey(node));
920
921
  }
922
+ /**
923
+ * Returns true if this node is a shadow host, is in a shadow host, or contains a shadow host
924
+ * anywhere in its tree.
925
+ */
926
+
927
+
928
+ function isNodeOrDescendantsShadowed(node) {
929
+ return isNodeShadowed(node) || isSyntheticShadowHost(node) || containsHost(node);
930
+ }
921
931
  /*
922
932
  * Copyright (c) 2018, salesforce.com, inc.
923
933
  * All rights reserved.
@@ -1561,7 +1571,7 @@ if (!_globalThis.lwcRuntimeFlags) {
1561
1571
  }
1562
1572
 
1563
1573
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
1564
- /** version: 2.6.2 */
1574
+ /** version: 2.6.3 */
1565
1575
 
1566
1576
  /*
1567
1577
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1655,7 +1665,9 @@ function parentElementGetterPatched() {
1655
1665
  }
1656
1666
 
1657
1667
  function compareDocumentPositionPatched(otherNode) {
1658
- if (this.getRootNode() === otherNode) {
1668
+ if (this === otherNode) {
1669
+ return 0;
1670
+ } else if (this.getRootNode() === otherNode) {
1659
1671
  // "this" is in a shadow tree where the shadow root is the "otherNode".
1660
1672
  return 10; // Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING
1661
1673
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
@@ -1701,7 +1713,7 @@ function cloneNodePatched(deep) {
1701
1713
  function childNodesGetterPatched() {
1702
1714
  if (isSyntheticShadowHost(this)) {
1703
1715
  const owner = getNodeOwner(this);
1704
- const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1716
+ const childNodes = isNull(owner) ? getFilteredChildNodes(this) : getAllMatches(owner, getFilteredChildNodes(this));
1705
1717
 
1706
1718
  if (process.env.NODE_ENV !== 'production' && isFalse(hasNativeSymbolSupport) && isExternalChildNodeAccessorFlagOn()) {
1707
1719
  // inserting a comment node as the first childNode to trick the IE11
@@ -1812,7 +1824,8 @@ defineProperties(_Node.prototype, {
1812
1824
  textContent: {
1813
1825
  get() {
1814
1826
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
1815
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1827
+ // See note on get innerHTML in faux-shadow/element.ts
1828
+ if (isNodeOrDescendantsShadowed(this)) {
1816
1829
  return textContentGetterPatched.call(this);
1817
1830
  }
1818
1831
 
@@ -2047,7 +2060,22 @@ function getAllRootNodes(node) {
2047
2060
  }
2048
2061
 
2049
2062
  return rootNodes;
2050
- }
2063
+ } // Keep searching up the host tree until we find an element that is within the immediate shadow root
2064
+
2065
+
2066
+ const findAncestorHostInImmediateShadowRoot = (rootNode, targetRootNode) => {
2067
+ let host;
2068
+
2069
+ while (!isUndefined(host = rootNode.host)) {
2070
+ const thisRootNode = host.getRootNode();
2071
+
2072
+ if (thisRootNode === targetRootNode) {
2073
+ return host;
2074
+ }
2075
+
2076
+ rootNode = thisRootNode;
2077
+ }
2078
+ };
2051
2079
 
2052
2080
  function fauxElementsFromPoint(context, doc, left, top) {
2053
2081
  const elements = elementsFromPoint.call(doc, left, top);
@@ -2061,8 +2089,28 @@ function fauxElementsFromPoint(context, doc, left, top) {
2061
2089
  for (let i = 0; i < elements.length; i++) {
2062
2090
  const element = elements[i];
2063
2091
 
2064
- if (rootNodes.indexOf(element.getRootNode()) !== -1 && !isSyntheticSlotElement(element)) {
2065
- result.push(element);
2092
+ if (isSyntheticSlotElement(element)) {
2093
+ continue;
2094
+ }
2095
+
2096
+ const elementRootNode = element.getRootNode();
2097
+
2098
+ if (ArrayIndexOf.call(rootNodes, elementRootNode) !== -1) {
2099
+ ArrayPush.call(result, element);
2100
+ continue;
2101
+ } // In cases where the host element is not visible but its shadow descendants are, then
2102
+ // we may get the shadow descendant instead of the host element here. (The
2103
+ // browser doesn't know the difference in synthetic shadow DOM.)
2104
+ // In native shadow DOM, however, elementsFromPoint would return the host but not
2105
+ // the child. So we need to detect if this shadow element's host is accessible from
2106
+ // the context's shadow root. Note we also need to be careful not to add the host
2107
+ // multiple times.
2108
+
2109
+
2110
+ const ancestorHost = findAncestorHostInImmediateShadowRoot(elementRootNode, rootNodes[0]);
2111
+
2112
+ if (!isUndefined(ancestorHost) && ArrayIndexOf.call(elements, ancestorHost) === -1 && ArrayIndexOf.call(result, ancestorHost) === -1) {
2113
+ ArrayPush.call(result, ancestorHost);
2066
2114
  }
2067
2115
  }
2068
2116
  }
@@ -2145,6 +2193,29 @@ function isSyntheticShadowHost(node) {
2145
2193
  function isSyntheticShadowRoot(node) {
2146
2194
  const shadowRootRecord = InternalSlot.get(node);
2147
2195
  return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
2196
+ } // Return true if any descendant is a host element
2197
+
2198
+
2199
+ function containsHost(node) {
2200
+ // IE11 complains with "Unexpected call to method or property access." when calling walker.nextNode().
2201
+ // The fix for this is to only walk trees for nodes that are Node.ELEMENT_NODE.
2202
+ if (node.nodeType !== _Node.ELEMENT_NODE) {
2203
+ return false;
2204
+ } // IE requires all four arguments, even though the fourth is deprecated
2205
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker#browser_compatibility
2206
+ // @ts-ignore
2207
+
2208
+
2209
+ const walker = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, null, false);
2210
+ let descendant;
2211
+
2212
+ while (!isNull(descendant = walker.nextNode())) {
2213
+ if (isSyntheticShadowHost(descendant)) {
2214
+ return true;
2215
+ }
2216
+ }
2217
+
2218
+ return false;
2148
2219
  }
2149
2220
 
2150
2221
  let uid = 0;
@@ -2195,6 +2266,12 @@ const SyntheticShadowRootDescriptors = {
2195
2266
  return `[object ShadowRoot]`;
2196
2267
  }
2197
2268
 
2269
+ },
2270
+ synthetic: {
2271
+ writable: false,
2272
+ enumerable: false,
2273
+ configurable: false,
2274
+ value: true
2198
2275
  }
2199
2276
  };
2200
2277
  const ShadowRootDescriptors = {
@@ -4033,6 +4110,14 @@ retargetRelatedTarget(FocusEvent);
4033
4110
  */
4034
4111
 
4035
4112
  retargetRelatedTarget(MouseEvent);
4113
+ /*
4114
+ * Copyright (c) 2021, salesforce.com, inc.
4115
+ * All rights reserved.
4116
+ * SPDX-License-Identifier: MIT
4117
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4118
+ */
4119
+
4120
+ const assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : () => null;
4036
4121
  /*
4037
4122
  * Copyright (c) 2018, salesforce.com, inc.
4038
4123
  * All rights reserved.
@@ -4086,10 +4171,22 @@ function getFilteredSlotFlattenNodes(slot) {
4086
4171
  }
4087
4172
 
4088
4173
  function assignedSlotGetterPatched() {
4089
- const parentNode = parentNodeGetter.call(this);
4174
+ const parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
4175
+
4176
+ if (parentNode instanceof Element) {
4177
+ const sr = shadowRootGetter.call(parentNode);
4178
+
4179
+ if (isInstanceOfNativeShadowRoot(sr)) {
4180
+ if (this instanceof Text) {
4181
+ return assignedSlotGetter.call(this);
4182
+ }
4183
+
4184
+ return assignedSlotGetter$1.call(this);
4185
+ }
4186
+ }
4090
4187
  /**
4091
4188
  * The node is assigned to a slot if:
4092
- * - it has a parent and it parent its parent is a slot element
4189
+ * - it has a parent and its parent is a slot element
4093
4190
  * - and if the slot owner key is different than the node owner key.
4094
4191
  *
4095
4192
  * When the slot and the slotted node are 2 different shadow trees, the owner keys will be
@@ -4098,6 +4195,7 @@ function assignedSlotGetterPatched() {
4098
4195
  * different than the node owner key (always `undefined`).
4099
4196
  */
4100
4197
 
4198
+
4101
4199
  if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
4102
4200
  return parentNode;
4103
4201
  }
@@ -4314,7 +4412,10 @@ defineProperties(Element.prototype, {
4314
4412
  innerHTML: {
4315
4413
  get() {
4316
4414
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4317
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4415
+ // If this element is in synthetic shadow, if it's a synthetic shadow host,
4416
+ // or if any of its descendants are synthetic shadow hosts, then we can't
4417
+ // use the native innerHTML because it would expose private node internals.
4418
+ if (isNodeOrDescendantsShadowed(this)) {
4318
4419
  return innerHTMLGetterPatched.call(this);
4319
4420
  }
4320
4421
 
@@ -4339,7 +4440,8 @@ defineProperties(Element.prototype, {
4339
4440
  outerHTML: {
4340
4441
  get() {
4341
4442
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4342
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4443
+ // See notes above on get innerHTML
4444
+ if (isNodeOrDescendantsShadowed(this)) {
4343
4445
  return outerHTMLGetterPatched.call(this);
4344
4446
  }
4345
4447
 
@@ -5722,4 +5824,4 @@ defineProperty(Element.prototype, '$domManual$', {
5722
5824
 
5723
5825
  configurable: true
5724
5826
  });
5725
- /** version: 2.6.2 */
5827
+ /** version: 2.6.3 */
@@ -197,7 +197,7 @@
197
197
  // we can't use typeof since it will fail when transpiling.
198
198
 
199
199
  const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
200
- /** version: 2.6.2 */
200
+ /** version: 2.6.3 */
201
201
 
202
202
  /*
203
203
  * Copyright (c) 2018, salesforce.com, inc.
@@ -305,6 +305,7 @@
305
305
  getElementsByClassName: getElementsByClassName$1
306
306
  } = HTMLElement.prototype;
307
307
  const shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : () => null;
308
+ const assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : () => null;
308
309
  /*
309
310
  * Copyright (c) 2018, salesforce.com, inc.
310
311
  * All rights reserved.
@@ -921,6 +922,15 @@
921
922
  function isNodeShadowed(node) {
922
923
  return !isUndefined(getNodeOwnerKey(node));
923
924
  }
925
+ /**
926
+ * Returns true if this node is a shadow host, is in a shadow host, or contains a shadow host
927
+ * anywhere in its tree.
928
+ */
929
+
930
+
931
+ function isNodeOrDescendantsShadowed(node) {
932
+ return isNodeShadowed(node) || isSyntheticShadowHost(node) || containsHost(node);
933
+ }
924
934
  /*
925
935
  * Copyright (c) 2018, salesforce.com, inc.
926
936
  * All rights reserved.
@@ -1564,7 +1574,7 @@
1564
1574
  }
1565
1575
 
1566
1576
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
1567
- /** version: 2.6.2 */
1577
+ /** version: 2.6.3 */
1568
1578
 
1569
1579
  /*
1570
1580
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1658,7 +1668,9 @@
1658
1668
  }
1659
1669
 
1660
1670
  function compareDocumentPositionPatched(otherNode) {
1661
- if (this.getRootNode() === otherNode) {
1671
+ if (this === otherNode) {
1672
+ return 0;
1673
+ } else if (this.getRootNode() === otherNode) {
1662
1674
  // "this" is in a shadow tree where the shadow root is the "otherNode".
1663
1675
  return 10; // Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING
1664
1676
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
@@ -1704,7 +1716,7 @@
1704
1716
  function childNodesGetterPatched() {
1705
1717
  if (isSyntheticShadowHost(this)) {
1706
1718
  const owner = getNodeOwner(this);
1707
- const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1719
+ const childNodes = isNull(owner) ? getFilteredChildNodes(this) : getAllMatches(owner, getFilteredChildNodes(this));
1708
1720
 
1709
1721
  if (process.env.NODE_ENV !== 'production' && isFalse(hasNativeSymbolSupport) && isExternalChildNodeAccessorFlagOn()) {
1710
1722
  // inserting a comment node as the first childNode to trick the IE11
@@ -1815,7 +1827,8 @@
1815
1827
  textContent: {
1816
1828
  get() {
1817
1829
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
1818
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1830
+ // See note on get innerHTML in faux-shadow/element.ts
1831
+ if (isNodeOrDescendantsShadowed(this)) {
1819
1832
  return textContentGetterPatched.call(this);
1820
1833
  }
1821
1834
 
@@ -2050,7 +2063,22 @@
2050
2063
  }
2051
2064
 
2052
2065
  return rootNodes;
2053
- }
2066
+ } // Keep searching up the host tree until we find an element that is within the immediate shadow root
2067
+
2068
+
2069
+ const findAncestorHostInImmediateShadowRoot = (rootNode, targetRootNode) => {
2070
+ let host;
2071
+
2072
+ while (!isUndefined(host = rootNode.host)) {
2073
+ const thisRootNode = host.getRootNode();
2074
+
2075
+ if (thisRootNode === targetRootNode) {
2076
+ return host;
2077
+ }
2078
+
2079
+ rootNode = thisRootNode;
2080
+ }
2081
+ };
2054
2082
 
2055
2083
  function fauxElementsFromPoint(context, doc, left, top) {
2056
2084
  const elements = elementsFromPoint.call(doc, left, top);
@@ -2064,8 +2092,28 @@
2064
2092
  for (let i = 0; i < elements.length; i++) {
2065
2093
  const element = elements[i];
2066
2094
 
2067
- if (rootNodes.indexOf(element.getRootNode()) !== -1 && !isSyntheticSlotElement(element)) {
2068
- result.push(element);
2095
+ if (isSyntheticSlotElement(element)) {
2096
+ continue;
2097
+ }
2098
+
2099
+ const elementRootNode = element.getRootNode();
2100
+
2101
+ if (ArrayIndexOf.call(rootNodes, elementRootNode) !== -1) {
2102
+ ArrayPush.call(result, element);
2103
+ continue;
2104
+ } // In cases where the host element is not visible but its shadow descendants are, then
2105
+ // we may get the shadow descendant instead of the host element here. (The
2106
+ // browser doesn't know the difference in synthetic shadow DOM.)
2107
+ // In native shadow DOM, however, elementsFromPoint would return the host but not
2108
+ // the child. So we need to detect if this shadow element's host is accessible from
2109
+ // the context's shadow root. Note we also need to be careful not to add the host
2110
+ // multiple times.
2111
+
2112
+
2113
+ const ancestorHost = findAncestorHostInImmediateShadowRoot(elementRootNode, rootNodes[0]);
2114
+
2115
+ if (!isUndefined(ancestorHost) && ArrayIndexOf.call(elements, ancestorHost) === -1 && ArrayIndexOf.call(result, ancestorHost) === -1) {
2116
+ ArrayPush.call(result, ancestorHost);
2069
2117
  }
2070
2118
  }
2071
2119
  }
@@ -2148,6 +2196,29 @@
2148
2196
  function isSyntheticShadowRoot(node) {
2149
2197
  const shadowRootRecord = InternalSlot.get(node);
2150
2198
  return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
2199
+ } // Return true if any descendant is a host element
2200
+
2201
+
2202
+ function containsHost(node) {
2203
+ // IE11 complains with "Unexpected call to method or property access." when calling walker.nextNode().
2204
+ // The fix for this is to only walk trees for nodes that are Node.ELEMENT_NODE.
2205
+ if (node.nodeType !== _Node.ELEMENT_NODE) {
2206
+ return false;
2207
+ } // IE requires all four arguments, even though the fourth is deprecated
2208
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker#browser_compatibility
2209
+ // @ts-ignore
2210
+
2211
+
2212
+ const walker = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, null, false);
2213
+ let descendant;
2214
+
2215
+ while (!isNull(descendant = walker.nextNode())) {
2216
+ if (isSyntheticShadowHost(descendant)) {
2217
+ return true;
2218
+ }
2219
+ }
2220
+
2221
+ return false;
2151
2222
  }
2152
2223
 
2153
2224
  let uid = 0;
@@ -2198,6 +2269,12 @@
2198
2269
  return `[object ShadowRoot]`;
2199
2270
  }
2200
2271
 
2272
+ },
2273
+ synthetic: {
2274
+ writable: false,
2275
+ enumerable: false,
2276
+ configurable: false,
2277
+ value: true
2201
2278
  }
2202
2279
  };
2203
2280
  const ShadowRootDescriptors = {
@@ -4036,6 +4113,14 @@
4036
4113
  */
4037
4114
 
4038
4115
  retargetRelatedTarget(MouseEvent);
4116
+ /*
4117
+ * Copyright (c) 2021, salesforce.com, inc.
4118
+ * All rights reserved.
4119
+ * SPDX-License-Identifier: MIT
4120
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4121
+ */
4122
+
4123
+ const assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : () => null;
4039
4124
  /*
4040
4125
  * Copyright (c) 2018, salesforce.com, inc.
4041
4126
  * All rights reserved.
@@ -4089,10 +4174,22 @@
4089
4174
  }
4090
4175
 
4091
4176
  function assignedSlotGetterPatched() {
4092
- const parentNode = parentNodeGetter.call(this);
4177
+ const parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
4178
+
4179
+ if (parentNode instanceof Element) {
4180
+ const sr = shadowRootGetter.call(parentNode);
4181
+
4182
+ if (isInstanceOfNativeShadowRoot(sr)) {
4183
+ if (this instanceof Text) {
4184
+ return assignedSlotGetter.call(this);
4185
+ }
4186
+
4187
+ return assignedSlotGetter$1.call(this);
4188
+ }
4189
+ }
4093
4190
  /**
4094
4191
  * The node is assigned to a slot if:
4095
- * - it has a parent and it parent its parent is a slot element
4192
+ * - it has a parent and its parent is a slot element
4096
4193
  * - and if the slot owner key is different than the node owner key.
4097
4194
  *
4098
4195
  * When the slot and the slotted node are 2 different shadow trees, the owner keys will be
@@ -4101,6 +4198,7 @@
4101
4198
  * different than the node owner key (always `undefined`).
4102
4199
  */
4103
4200
 
4201
+
4104
4202
  if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
4105
4203
  return parentNode;
4106
4204
  }
@@ -4317,7 +4415,10 @@
4317
4415
  innerHTML: {
4318
4416
  get() {
4319
4417
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4320
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4418
+ // If this element is in synthetic shadow, if it's a synthetic shadow host,
4419
+ // or if any of its descendants are synthetic shadow hosts, then we can't
4420
+ // use the native innerHTML because it would expose private node internals.
4421
+ if (isNodeOrDescendantsShadowed(this)) {
4321
4422
  return innerHTMLGetterPatched.call(this);
4322
4423
  }
4323
4424
 
@@ -4342,7 +4443,8 @@
4342
4443
  outerHTML: {
4343
4444
  get() {
4344
4445
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4345
- if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4446
+ // See notes above on get innerHTML
4447
+ if (isNodeOrDescendantsShadowed(this)) {
4346
4448
  return outerHTMLGetterPatched.call(this);
4347
4449
  }
4348
4450
 
@@ -5725,6 +5827,6 @@
5725
5827
 
5726
5828
  configurable: true
5727
5829
  });
5728
- /** version: 2.6.2 */
5830
+ /** version: 2.6.3 */
5729
5831
 
5730
5832
  })();