@lwc/synthetic-shadow 2.7.0 → 2.7.1

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.
@@ -194,7 +194,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
194
194
 
195
195
 
196
196
  const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
197
- /** version: 2.7.0 */
197
+ /** version: 2.7.1 */
198
198
 
199
199
  /*
200
200
  * Copyright (c) 2018, salesforce.com, inc.
@@ -301,6 +301,7 @@ const {
301
301
  getElementsByClassName: getElementsByClassName$1
302
302
  } = HTMLElement.prototype;
303
303
  const shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : () => null;
304
+ const assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : () => null;
304
305
 
305
306
  /*
306
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1523,7 +1524,7 @@ if (!_globalThis.lwcRuntimeFlags) {
1523
1524
  }
1524
1525
 
1525
1526
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
1526
- /** version: 2.7.0 */
1527
+ /** version: 2.7.1 */
1527
1528
 
1528
1529
  /*
1529
1530
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1616,7 +1617,9 @@ function parentElementGetterPatched() {
1616
1617
  }
1617
1618
 
1618
1619
  function compareDocumentPositionPatched(otherNode) {
1619
- if (this.getRootNode() === otherNode) {
1620
+ if (this === otherNode) {
1621
+ return 0;
1622
+ } else if (this.getRootNode() === otherNode) {
1620
1623
  // "this" is in a shadow tree where the shadow root is the "otherNode".
1621
1624
  return 10; // Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING
1622
1625
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
@@ -3977,6 +3980,14 @@ retargetRelatedTarget(FocusEvent);
3977
3980
  */
3978
3981
  retargetRelatedTarget(MouseEvent);
3979
3982
 
3983
+ /*
3984
+ * Copyright (c) 2021, salesforce.com, inc.
3985
+ * All rights reserved.
3986
+ * SPDX-License-Identifier: MIT
3987
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3988
+ */
3989
+ const assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : () => null;
3990
+
3980
3991
  /*
3981
3992
  * Copyright (c) 2018, salesforce.com, inc.
3982
3993
  * All rights reserved.
@@ -4030,10 +4041,22 @@ function getFilteredSlotFlattenNodes(slot) {
4030
4041
  }
4031
4042
 
4032
4043
  function assignedSlotGetterPatched() {
4033
- const parentNode = parentNodeGetter.call(this);
4044
+ const parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
4045
+
4046
+ if (parentNode instanceof Element) {
4047
+ const sr = shadowRootGetter.call(parentNode);
4048
+
4049
+ if (isInstanceOfNativeShadowRoot(sr)) {
4050
+ if (this instanceof Text) {
4051
+ return assignedSlotGetter.call(this);
4052
+ }
4053
+
4054
+ return assignedSlotGetter$1.call(this);
4055
+ }
4056
+ }
4034
4057
  /**
4035
4058
  * The node is assigned to a slot if:
4036
- * - it has a parent and it parent its parent is a slot element
4059
+ * - it has a parent and its parent is a slot element
4037
4060
  * - and if the slot owner key is different than the node owner key.
4038
4061
  *
4039
4062
  * When the slot and the slotted node are 2 different shadow trees, the owner keys will be
@@ -4042,6 +4065,7 @@ function assignedSlotGetterPatched() {
4042
4065
  * different than the node owner key (always `undefined`).
4043
4066
  */
4044
4067
 
4068
+
4045
4069
  if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
4046
4070
  return parentNode;
4047
4071
  }
@@ -5656,4 +5680,4 @@ defineProperty(Element.prototype, '$domManual$', {
5656
5680
 
5657
5681
  configurable: true
5658
5682
  });
5659
- /** version: 2.7.0 */
5683
+ /** version: 2.7.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/synthetic-shadow",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "description": "Synthetic Shadow Root for LWC",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwc/features": "2.7.0",
40
- "@lwc/shared": "2.7.0"
39
+ "@lwc/features": "2.7.1",
40
+ "@lwc/shared": "2.7.1"
41
41
  },
42
- "gitHead": "656663a9f95f90bd648c6fc2200201afc0156393"
42
+ "gitHead": "1b2e246e03c6bfbc80bea3def43b7d0281a1de21"
43
43
  }