@lwc/synthetic-shadow 2.23.4 → 2.23.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -148,7 +148,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
148
148
  // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
149
149
  // we can't use typeof since it will fail when transpiling.
150
150
  const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
151
- /** version: 2.23.4 */
151
+ /** version: 2.23.6 */
152
152
 
153
153
  /*
154
154
  * Copyright (c) 2018, salesforce.com, inc.
@@ -455,58 +455,86 @@ function arrayFromCollection(collection) {
455
455
  const eventTargetPrototype = typeof EventTarget !== 'undefined' ? EventTarget.prototype : _Node.prototype;
456
456
  const { addEventListener, dispatchEvent, removeEventListener } = eventTargetPrototype;
457
457
 
458
+ /**
459
+ * Copyright (C) 2018 salesforce.com, inc.
460
+ */
461
+ if (!_globalThis.lwcRuntimeFlags) {
462
+ Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
463
+ }
464
+ const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
465
+ /** version: 2.23.6 */
466
+
458
467
  /*
459
468
  * Copyright (c) 2018, salesforce.com, inc.
460
469
  * All rights reserved.
461
470
  * SPDX-License-Identifier: MIT
462
471
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
463
472
  */
464
- // Used as a back reference to identify the host element
473
+
465
474
  const HostElementKey = '$$HostElementKey$$';
466
475
  const ShadowedNodeKey = '$$ShadowedNodeKey$$';
476
+
467
477
  function fastDefineProperty(node, propName, config) {
468
- const shadowedNode = node;
469
- if (process.env.NODE_ENV !== 'production') {
470
- // in dev, we are more restrictive
471
- defineProperty(shadowedNode, propName, config);
472
- }
473
- else {
474
- const { value } = config;
475
- // in prod, we prioritize performance
476
- shadowedNode[propName] = value;
477
- }
478
+ const shadowedNode = node;
479
+
480
+ if (process.env.NODE_ENV !== 'production') {
481
+ // in dev, we are more restrictive
482
+ defineProperty(shadowedNode, propName, config);
483
+ } else {
484
+ const {
485
+ value
486
+ } = config; // in prod, we prioritize performance
487
+
488
+ shadowedNode[propName] = value;
489
+ }
478
490
  }
491
+
479
492
  function setNodeOwnerKey(node, value) {
480
- fastDefineProperty(node, HostElementKey, { value, configurable: true });
493
+ fastDefineProperty(node, HostElementKey, {
494
+ value,
495
+ configurable: true
496
+ });
481
497
  }
482
498
  function setNodeKey(node, value) {
483
- fastDefineProperty(node, ShadowedNodeKey, { value });
499
+ fastDefineProperty(node, ShadowedNodeKey, {
500
+ value
501
+ });
484
502
  }
485
503
  function getNodeOwnerKey(node) {
486
- return node[HostElementKey];
504
+ return node[HostElementKey];
487
505
  }
488
506
  function getNodeNearestOwnerKey(node) {
489
- let host = node;
490
- let hostKey;
491
- // search for the first element with owner identity (just in case of manually inserted elements)
492
- while (!isNull(host)) {
493
- hostKey = getNodeOwnerKey(host);
494
- if (!isUndefined(hostKey)) {
495
- return hostKey;
496
- }
497
- host = parentNodeGetter.call(host);
507
+ let host = node;
508
+ let hostKey; // search for the first element with owner identity
509
+ // in case of manually inserted elements and elements slotted from Light DOM
510
+
511
+ while (!isNull(host)) {
512
+ hostKey = getNodeOwnerKey(host);
513
+
514
+ if (!isUndefined(hostKey)) {
515
+ return hostKey;
498
516
  }
517
+
518
+ host = parentNodeGetter.call(host);
519
+
520
+ if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
521
+ if (!isNull(host) && isSyntheticSlotElement(host)) {
522
+ return undefined;
523
+ }
524
+ }
525
+ }
499
526
  }
500
527
  function getNodeKey(node) {
501
- return node[ShadowedNodeKey];
528
+ return node[ShadowedNodeKey];
502
529
  }
503
530
  /**
504
531
  * This function does not traverse up for performance reasons, but is sufficient for most use
505
532
  * cases. If we need to traverse up and verify those nodes that don't have owner key, use
506
533
  * isNodeDeepShadowed instead.
507
534
  */
535
+
508
536
  function isNodeShadowed(node) {
509
- return !isUndefined(getNodeOwnerKey(node));
537
+ return !isUndefined(getNodeOwnerKey(node));
510
538
  }
511
539
 
512
540
  /*
@@ -1117,15 +1145,6 @@ function createStaticHTMLCollection(items) {
1117
1145
  return collection;
1118
1146
  }
1119
1147
 
1120
- /**
1121
- * Copyright (C) 2018 salesforce.com, inc.
1122
- */
1123
- if (!_globalThis.lwcRuntimeFlags) {
1124
- Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
1125
- }
1126
- const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
1127
- /** version: 2.23.4 */
1128
-
1129
1148
  /*
1130
1149
  * Copyright (c) 2018, salesforce.com, inc.
1131
1150
  * All rights reserved.
@@ -5114,4 +5133,4 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
5114
5133
  }));
5115
5134
  });
5116
5135
  }
5117
- /** version: 2.23.4 */
5136
+ /** version: 2.23.6 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/synthetic-shadow",
3
- "version": "2.23.4",
3
+ "version": "2.23.6",
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.23.4",
40
- "@lwc/shared": "2.23.4"
39
+ "@lwc/features": "2.23.6",
40
+ "@lwc/shared": "2.23.6"
41
41
  },
42
42
  "nx": {
43
43
  "targets": {