@lwc/synthetic-shadow 2.5.4 → 2.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.5.4 */
197
+ /** version: 2.5.8 */
198
198
 
199
199
  /*
200
200
  * Copyright (c) 2018, salesforce.com, inc.
@@ -526,7 +526,7 @@ if (!_globalThis.lwcRuntimeFlags) {
526
526
  }
527
527
 
528
528
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
529
- /** version: 2.5.4 */
529
+ /** version: 2.5.8 */
530
530
 
531
531
  /*
532
532
  * Copyright (c) 2018, salesforce.com, inc.
@@ -629,9 +629,9 @@ const GET_ROOT_NODE_CONFIG_FALSE = {
629
629
  };
630
630
 
631
631
  function getRootNodeHost(node, options) {
632
- let rootNode = node.getRootNode(options); // is SyntheticShadowRootInterface
632
+ let rootNode = node.getRootNode(options);
633
633
 
634
- if ('mode' in rootNode && 'delegatesFocus' in rootNode) {
634
+ if (isSyntheticShadowRoot(rootNode)) {
635
635
  rootNode = getHost(rootNode);
636
636
  }
637
637
 
@@ -1019,14 +1019,6 @@ function getNodeKey(node) {
1019
1019
  function isNodeShadowed(node) {
1020
1020
  return !isUndefined(getNodeOwnerKey(node));
1021
1021
  }
1022
- /**
1023
- * Returns true if this node is a shadow host, is in a shadow host, or contains a shadow host
1024
- * anywhere in its tree.
1025
- */
1026
-
1027
- function isNodeOrDescendantsShadowed(node) {
1028
- return isNodeShadowed(node) || isSyntheticShadowHost(node) || containsHost(node);
1029
- }
1030
1022
 
1031
1023
  /*
1032
1024
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1777,7 +1769,7 @@ function cloneNodePatched(deep) {
1777
1769
  function childNodesGetterPatched() {
1778
1770
  if (isSyntheticShadowHost(this)) {
1779
1771
  const owner = getNodeOwner(this);
1780
- const childNodes = isNull(owner) ? getFilteredChildNodes(this) : getAllMatches(owner, getFilteredChildNodes(this));
1772
+ const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1781
1773
 
1782
1774
  if (process.env.NODE_ENV !== 'production' && isFalse(hasNativeSymbolSupport) && isExternalChildNodeAccessorFlagOn()) {
1783
1775
  // inserting a comment node as the first childNode to trick the IE11
@@ -1888,8 +1880,7 @@ defineProperties(_Node.prototype, {
1888
1880
  textContent: {
1889
1881
  get() {
1890
1882
  if (!runtimeFlags.ENABLE_NODE_PATCH) {
1891
- // See note on get innerHTML in faux-shadow/element.ts
1892
- if (isNodeOrDescendantsShadowed(this)) {
1883
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1893
1884
  return textContentGetterPatched.call(this);
1894
1885
  }
1895
1886
 
@@ -2212,21 +2203,6 @@ function isSyntheticShadowHost(node) {
2212
2203
  function isSyntheticShadowRoot(node) {
2213
2204
  const shadowRootRecord = InternalSlot.get(node);
2214
2205
  return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
2215
- } // Return true if any descendant is a host element
2216
-
2217
- function containsHost(node) {
2218
- // IE requires all arguments
2219
- // https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker#browser_compatibility
2220
- const walker = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, null, false);
2221
- let descendant;
2222
-
2223
- while (!isNull(descendant = walker.nextNode())) {
2224
- if (isSyntheticShadowHost(descendant)) {
2225
- return true;
2226
- }
2227
- }
2228
-
2229
- return false;
2230
2206
  }
2231
2207
  let uid = 0;
2232
2208
  function attachShadow(elm, options) {
@@ -4383,10 +4359,7 @@ defineProperties(Element.prototype, {
4383
4359
  innerHTML: {
4384
4360
  get() {
4385
4361
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4386
- // If this element is in synthetic shadow, if it's a synthetic shadow host,
4387
- // or if any of its descendants are synthetic shadow hosts, then we can't
4388
- // use the native innerHTML because it would expose private node internals.
4389
- if (isNodeOrDescendantsShadowed(this)) {
4362
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4390
4363
  return innerHTMLGetterPatched.call(this);
4391
4364
  }
4392
4365
 
@@ -4411,8 +4384,7 @@ defineProperties(Element.prototype, {
4411
4384
  outerHTML: {
4412
4385
  get() {
4413
4386
  if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
4414
- // See notes above on get innerHTML
4415
- if (isNodeOrDescendantsShadowed(this)) {
4387
+ if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4416
4388
  return outerHTMLGetterPatched.call(this);
4417
4389
  }
4418
4390
 
@@ -5785,4 +5757,4 @@ defineProperty(Element.prototype, '$domManual$', {
5785
5757
 
5786
5758
  configurable: true
5787
5759
  });
5788
- /** version: 2.5.4 */
5760
+ /** version: 2.5.8 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/synthetic-shadow",
3
- "version": "2.5.4",
3
+ "version": "2.5.8",
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.5.4",
40
- "@lwc/shared": "2.5.4"
39
+ "@lwc/features": "2.5.8",
40
+ "@lwc/shared": "2.5.8"
41
41
  },
42
- "gitHead": "ff17b5fc759b6444e16fa7adb559bede758136c9"
42
+ "gitHead": "223513a6a4e070b3243db0a345024a184f82dc08"
43
43
  }