lwc 2.8.0 → 2.9.0

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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +73 -34
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +73 -34
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +73 -34
  5. package/dist/engine-dom/iife/es5/engine-dom.js +144 -100
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +137 -94
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +73 -34
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +73 -34
  11. package/dist/engine-dom/umd/es5/engine-dom.js +144 -100
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +137 -94
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +41 -19
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +41 -19
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -303,7 +303,7 @@ function htmlPropertyToAttribute(propName) {
303
303
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
304
304
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
305
305
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
306
- /** version: 2.8.0 */
306
+ /** version: 2.9.0 */
307
307
 
308
308
  /*
309
309
  * Copyright (c) 2018, salesforce.com, inc.
@@ -480,7 +480,7 @@ function setFeatureFlagForTest(name, value) {
480
480
  setFeatureFlag(name, value);
481
481
  }
482
482
  }
483
- /** version: 2.8.0 */
483
+ /** version: 2.9.0 */
484
484
 
485
485
  /* proxy-compat-disable */
486
486
 
@@ -554,6 +554,19 @@ function parseStyleText(cssText) {
554
554
  }
555
555
 
556
556
  return styleMap;
557
+ } // Make a shallow copy of an object but omit the given key
558
+
559
+
560
+ function cloneAndOmitKey(object, keyToOmit) {
561
+ const result = {};
562
+
563
+ for (const key of Object.keys(object)) {
564
+ if (key !== keyToOmit) {
565
+ result[key] = object[key];
566
+ }
567
+ }
568
+
569
+ return result;
557
570
  } //
558
571
  // Primitives
559
572
  //
@@ -4792,11 +4805,13 @@ function fallbackElmHook(elm, vnode) {
4792
4805
  ) {
4793
4806
  // this element will now accept any manual content inserted into it
4794
4807
  observeElementChildNodes(elm);
4795
- } // when running in synthetic shadow mode, we need to set the shadowToken value
4796
- // into each element from the template, so they can be styled accordingly.
4797
-
4808
+ }
4798
4809
 
4799
- setElementShadowToken(elm, stylesheetToken);
4810
+ if (!isUndefined$1(stylesheetToken)) {
4811
+ // when running in synthetic shadow mode, we need to set the shadowToken value
4812
+ // into each element from the template, so they can be styled accordingly.
4813
+ setElementShadowToken(elm, stylesheetToken);
4814
+ }
4800
4815
  }
4801
4816
 
4802
4817
  if (process.env.NODE_ENV !== 'production') {
@@ -4883,7 +4898,9 @@ function createViewModelHook(elm, vnode) {
4883
4898
  } = owner.context; // when running in synthetic shadow mode, we need to set the shadowToken value
4884
4899
  // into each element from the template, so they can be styled accordingly.
4885
4900
 
4886
- setElementShadowToken(elm, stylesheetToken);
4901
+ if (!isUndefined$1(stylesheetToken)) {
4902
+ setElementShadowToken(elm, stylesheetToken);
4903
+ }
4887
4904
  }
4888
4905
 
4889
4906
  vm = createVM(elm, ctor, {
@@ -5064,6 +5081,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
5064
5081
  let idxInOld;
5065
5082
  let elmToMove;
5066
5083
  let before;
5084
+ let clonedOldCh = false;
5067
5085
 
5068
5086
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
5069
5087
  if (!isVNode(oldStartVnode)) {
@@ -5115,7 +5133,18 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
5115
5133
  newStartVnode.hook.create(newStartVnode);
5116
5134
  newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
5117
5135
  } else {
5118
- patchVnode(elmToMove, newStartVnode);
5136
+ patchVnode(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
5137
+ // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5138
+ // so we only care about the `oldCh` object inside this function.
5139
+ // To avoid cloning over and over again, we check `clonedOldCh`
5140
+ // and only clone once.
5141
+
5142
+ if (!clonedOldCh) {
5143
+ clonedOldCh = true;
5144
+ oldCh = [...oldCh];
5145
+ } // We've already cloned at least once, so it's no longer read-only
5146
+
5147
+
5119
5148
  oldCh[idxInOld] = undefined;
5120
5149
  newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
5121
5150
  }
@@ -5212,7 +5241,7 @@ function addVNodeToChildLWC(vnode) {
5212
5241
  } // [h]tml node
5213
5242
 
5214
5243
 
5215
- function h(sel, data, children) {
5244
+ function h(sel, data, children = EmptyArray) {
5216
5245
  const vmBeingRendered = getVMBeingRendered();
5217
5246
 
5218
5247
  if (process.env.NODE_ENV !== 'production') {
@@ -5610,7 +5639,7 @@ let dynamicImportedComponentCounter = 0;
5610
5639
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5611
5640
  */
5612
5641
 
5613
- function dc(sel, Ctor, data, children) {
5642
+ function dc(sel, Ctor, data, children = EmptyArray) {
5614
5643
  if (process.env.NODE_ENV !== 'production') {
5615
5644
  assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
5616
5645
  assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
@@ -5634,10 +5663,14 @@ function dc(sel, Ctor, data, children) {
5634
5663
  } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5635
5664
  // to identify different constructors as vnodes with different keys to avoid reusing the
5636
5665
  // element used for previous constructors.
5666
+ // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5667
+ // hoisting optimization.
5637
5668
 
5638
5669
 
5639
- data.key = `dc:${idx}:${data.key}`;
5640
- return c(sel, Ctor, data, children);
5670
+ const newData = Object.assign(Object.assign({}, data), {
5671
+ key: `dc:${idx}:${data.key}`
5672
+ });
5673
+ return c(sel, Ctor, newData, children);
5641
5674
  }
5642
5675
  /**
5643
5676
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5757,12 +5790,14 @@ function updateStylesheetToken(vm, template) {
5757
5790
  hasTokenInAttribute: oldHasTokenInAttribute
5758
5791
  } = context;
5759
5792
 
5760
- if (oldHasTokenInClass) {
5761
- getClassList$1(elm).remove(makeHostToken(oldToken));
5762
- }
5793
+ if (!isUndefined$1(oldToken)) {
5794
+ if (oldHasTokenInClass) {
5795
+ getClassList$1(elm).remove(makeHostToken(oldToken));
5796
+ }
5763
5797
 
5764
- if (oldHasTokenInAttribute) {
5765
- removeAttribute$1(elm, makeHostToken(oldToken));
5798
+ if (oldHasTokenInAttribute) {
5799
+ removeAttribute$1(elm, makeHostToken(oldToken));
5800
+ }
5766
5801
  } // Apply the new template styling token to the host element, if the new template has any
5767
5802
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
5768
5803
 
@@ -6567,7 +6602,10 @@ function hydrateElement(vnode, node) {
6567
6602
 
6568
6603
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
6569
6604
  if (elm.innerHTML === props.innerHTML) {
6570
- delete props.innerHTML;
6605
+ // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
6606
+ vnode.data = Object.assign(Object.assign({}, vnode.data), {
6607
+ props: cloneAndOmitKey(props, 'innerHTML')
6608
+ });
6571
6609
  } else {
6572
6610
  logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
6573
6611
  }
@@ -7864,7 +7902,7 @@ function setHooks(hooks) {
7864
7902
  hooksAreSet = true;
7865
7903
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7866
7904
  }
7867
- /* version: 2.8.0 */
7905
+ /* version: 2.9.0 */
7868
7906
 
7869
7907
  /*
7870
7908
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8495,30 +8533,31 @@ function getComponentConstructor(elm) {
8495
8533
 
8496
8534
  const _Node = Node;
8497
8535
  /**
8498
- * EXPERIMENTAL: This function detects whether or not a Node is controlled by a LWC template. This
8499
- * API is subject to change or being removed.
8536
+ * EXPERIMENTAL: The purpose of this function is to detect shadowed nodes. THIS API WILL BE REMOVED
8537
+ * ONCE LOCKER V1 IS NO LONGER SUPPORTED.
8500
8538
  */
8501
8539
 
8502
- function isNodeFromTemplate(node) {
8540
+ function isNodeShadowed(node) {
8503
8541
  if (isFalse(node instanceof _Node)) {
8504
8542
  return false;
8505
- } // TODO [#1250]: skipping the shadowRoot instances itself makes no sense, we need to revisit
8506
- // this with locker
8543
+ } // It's debatable whether shadow root instances should be considered as shadowed, but we keep
8544
+ // this unchanged for legacy reasons (#1250).
8507
8545
 
8508
8546
 
8509
8547
  if (node instanceof ShadowRoot) {
8510
8548
  return false;
8511
8549
  }
8512
8550
 
8513
- if (isSyntheticShadowDefined) {
8514
- // TODO [#1252]: old behavior that is still used by some pieces of the platform,
8515
- // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
8516
- // used, will be considered global elements.
8517
- return !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
8518
- }
8551
+ const rootNode = node.getRootNode(); // Handle the native case. We can return early here because an invariant of LWC is that
8552
+ // synthetic roots cannot be descendants of native roots.
8553
+
8554
+ if (rootNode instanceof ShadowRoot && isFalse(hasOwnProperty$1.call(getPrototypeOf$1(rootNode), 'synthetic'))) {
8555
+ return true;
8556
+ } // TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
8557
+ // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
8558
+
8519
8559
 
8520
- const root = node.getRootNode();
8521
- return root instanceof ShadowRoot;
8560
+ return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
8522
8561
  }
8523
8562
  /*
8524
8563
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8563,6 +8602,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8563
8602
  });
8564
8603
  freeze(LightningElement);
8565
8604
  seal(LightningElement.prototype);
8566
- /* version: 2.8.0 */
8605
+ /* version: 2.9.0 */
8567
8606
 
8568
- export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8607
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
@@ -306,7 +306,7 @@ var LWC = (function (exports) {
306
306
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
307
307
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
308
308
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
309
- /** version: 2.8.0 */
309
+ /** version: 2.9.0 */
310
310
 
311
311
  /*
312
312
  * Copyright (c) 2018, salesforce.com, inc.
@@ -483,7 +483,7 @@ var LWC = (function (exports) {
483
483
  setFeatureFlag(name, value);
484
484
  }
485
485
  }
486
- /** version: 2.8.0 */
486
+ /** version: 2.9.0 */
487
487
 
488
488
  /* proxy-compat-disable */
489
489
 
@@ -557,6 +557,19 @@ var LWC = (function (exports) {
557
557
  }
558
558
 
559
559
  return styleMap;
560
+ } // Make a shallow copy of an object but omit the given key
561
+
562
+
563
+ function cloneAndOmitKey(object, keyToOmit) {
564
+ const result = {};
565
+
566
+ for (const key of Object.keys(object)) {
567
+ if (key !== keyToOmit) {
568
+ result[key] = object[key];
569
+ }
570
+ }
571
+
572
+ return result;
560
573
  } //
561
574
  // Primitives
562
575
  //
@@ -4795,11 +4808,13 @@ var LWC = (function (exports) {
4795
4808
  ) {
4796
4809
  // this element will now accept any manual content inserted into it
4797
4810
  observeElementChildNodes(elm);
4798
- } // when running in synthetic shadow mode, we need to set the shadowToken value
4799
- // into each element from the template, so they can be styled accordingly.
4800
-
4811
+ }
4801
4812
 
4802
- setElementShadowToken(elm, stylesheetToken);
4813
+ if (!isUndefined$1(stylesheetToken)) {
4814
+ // when running in synthetic shadow mode, we need to set the shadowToken value
4815
+ // into each element from the template, so they can be styled accordingly.
4816
+ setElementShadowToken(elm, stylesheetToken);
4817
+ }
4803
4818
  }
4804
4819
 
4805
4820
  if (process.env.NODE_ENV !== 'production') {
@@ -4886,7 +4901,9 @@ var LWC = (function (exports) {
4886
4901
  } = owner.context; // when running in synthetic shadow mode, we need to set the shadowToken value
4887
4902
  // into each element from the template, so they can be styled accordingly.
4888
4903
 
4889
- setElementShadowToken(elm, stylesheetToken);
4904
+ if (!isUndefined$1(stylesheetToken)) {
4905
+ setElementShadowToken(elm, stylesheetToken);
4906
+ }
4890
4907
  }
4891
4908
 
4892
4909
  vm = createVM(elm, ctor, {
@@ -5067,6 +5084,7 @@ var LWC = (function (exports) {
5067
5084
  let idxInOld;
5068
5085
  let elmToMove;
5069
5086
  let before;
5087
+ let clonedOldCh = false;
5070
5088
 
5071
5089
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
5072
5090
  if (!isVNode(oldStartVnode)) {
@@ -5118,7 +5136,18 @@ var LWC = (function (exports) {
5118
5136
  newStartVnode.hook.create(newStartVnode);
5119
5137
  newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
5120
5138
  } else {
5121
- patchVnode(elmToMove, newStartVnode);
5139
+ patchVnode(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
5140
+ // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5141
+ // so we only care about the `oldCh` object inside this function.
5142
+ // To avoid cloning over and over again, we check `clonedOldCh`
5143
+ // and only clone once.
5144
+
5145
+ if (!clonedOldCh) {
5146
+ clonedOldCh = true;
5147
+ oldCh = [...oldCh];
5148
+ } // We've already cloned at least once, so it's no longer read-only
5149
+
5150
+
5122
5151
  oldCh[idxInOld] = undefined;
5123
5152
  newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
5124
5153
  }
@@ -5215,7 +5244,7 @@ var LWC = (function (exports) {
5215
5244
  } // [h]tml node
5216
5245
 
5217
5246
 
5218
- function h(sel, data, children) {
5247
+ function h(sel, data, children = EmptyArray) {
5219
5248
  const vmBeingRendered = getVMBeingRendered();
5220
5249
 
5221
5250
  if (process.env.NODE_ENV !== 'production') {
@@ -5613,7 +5642,7 @@ var LWC = (function (exports) {
5613
5642
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5614
5643
  */
5615
5644
 
5616
- function dc(sel, Ctor, data, children) {
5645
+ function dc(sel, Ctor, data, children = EmptyArray) {
5617
5646
  if (process.env.NODE_ENV !== 'production') {
5618
5647
  assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
5619
5648
  assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
@@ -5637,10 +5666,14 @@ var LWC = (function (exports) {
5637
5666
  } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5638
5667
  // to identify different constructors as vnodes with different keys to avoid reusing the
5639
5668
  // element used for previous constructors.
5669
+ // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5670
+ // hoisting optimization.
5640
5671
 
5641
5672
 
5642
- data.key = `dc:${idx}:${data.key}`;
5643
- return c(sel, Ctor, data, children);
5673
+ const newData = Object.assign(Object.assign({}, data), {
5674
+ key: `dc:${idx}:${data.key}`
5675
+ });
5676
+ return c(sel, Ctor, newData, children);
5644
5677
  }
5645
5678
  /**
5646
5679
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5760,12 +5793,14 @@ var LWC = (function (exports) {
5760
5793
  hasTokenInAttribute: oldHasTokenInAttribute
5761
5794
  } = context;
5762
5795
 
5763
- if (oldHasTokenInClass) {
5764
- getClassList$1(elm).remove(makeHostToken(oldToken));
5765
- }
5796
+ if (!isUndefined$1(oldToken)) {
5797
+ if (oldHasTokenInClass) {
5798
+ getClassList$1(elm).remove(makeHostToken(oldToken));
5799
+ }
5766
5800
 
5767
- if (oldHasTokenInAttribute) {
5768
- removeAttribute$1(elm, makeHostToken(oldToken));
5801
+ if (oldHasTokenInAttribute) {
5802
+ removeAttribute$1(elm, makeHostToken(oldToken));
5803
+ }
5769
5804
  } // Apply the new template styling token to the host element, if the new template has any
5770
5805
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
5771
5806
 
@@ -6570,7 +6605,10 @@ var LWC = (function (exports) {
6570
6605
 
6571
6606
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
6572
6607
  if (elm.innerHTML === props.innerHTML) {
6573
- delete props.innerHTML;
6608
+ // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
6609
+ vnode.data = Object.assign(Object.assign({}, vnode.data), {
6610
+ props: cloneAndOmitKey(props, 'innerHTML')
6611
+ });
6574
6612
  } else {
6575
6613
  logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
6576
6614
  }
@@ -7867,7 +7905,7 @@ var LWC = (function (exports) {
7867
7905
  hooksAreSet = true;
7868
7906
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7869
7907
  }
7870
- /* version: 2.8.0 */
7908
+ /* version: 2.9.0 */
7871
7909
 
7872
7910
  /*
7873
7911
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8498,30 +8536,31 @@ var LWC = (function (exports) {
8498
8536
 
8499
8537
  const _Node = Node;
8500
8538
  /**
8501
- * EXPERIMENTAL: This function detects whether or not a Node is controlled by a LWC template. This
8502
- * API is subject to change or being removed.
8539
+ * EXPERIMENTAL: The purpose of this function is to detect shadowed nodes. THIS API WILL BE REMOVED
8540
+ * ONCE LOCKER V1 IS NO LONGER SUPPORTED.
8503
8541
  */
8504
8542
 
8505
- function isNodeFromTemplate(node) {
8543
+ function isNodeShadowed(node) {
8506
8544
  if (isFalse(node instanceof _Node)) {
8507
8545
  return false;
8508
- } // TODO [#1250]: skipping the shadowRoot instances itself makes no sense, we need to revisit
8509
- // this with locker
8546
+ } // It's debatable whether shadow root instances should be considered as shadowed, but we keep
8547
+ // this unchanged for legacy reasons (#1250).
8510
8548
 
8511
8549
 
8512
8550
  if (node instanceof ShadowRoot) {
8513
8551
  return false;
8514
8552
  }
8515
8553
 
8516
- if (isSyntheticShadowDefined) {
8517
- // TODO [#1252]: old behavior that is still used by some pieces of the platform,
8518
- // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
8519
- // used, will be considered global elements.
8520
- return !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
8521
- }
8554
+ const rootNode = node.getRootNode(); // Handle the native case. We can return early here because an invariant of LWC is that
8555
+ // synthetic roots cannot be descendants of native roots.
8556
+
8557
+ if (rootNode instanceof ShadowRoot && isFalse(hasOwnProperty$1.call(getPrototypeOf$1(rootNode), 'synthetic'))) {
8558
+ return true;
8559
+ } // TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
8560
+ // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
8561
+
8522
8562
 
8523
- const root = node.getRootNode();
8524
- return root instanceof ShadowRoot;
8563
+ return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
8525
8564
  }
8526
8565
  /*
8527
8566
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8566,7 +8605,7 @@ var LWC = (function (exports) {
8566
8605
  });
8567
8606
  freeze(LightningElement);
8568
8607
  seal(LightningElement.prototype);
8569
- /* version: 2.8.0 */
8608
+ /* version: 2.9.0 */
8570
8609
 
8571
8610
  exports.LightningElement = LightningElement;
8572
8611
  exports.__unstable__ProfilerControl = profilerControl;
@@ -8578,7 +8617,7 @@ var LWC = (function (exports) {
8578
8617
  exports.getComponentDef = getComponentDef;
8579
8618
  exports.hydrateComponent = hydrateComponent;
8580
8619
  exports.isComponentConstructor = isComponentConstructor;
8581
- exports.isNodeFromTemplate = isNodeFromTemplate;
8620
+ exports.isNodeFromTemplate = isNodeShadowed;
8582
8621
  exports.readonly = readonly;
8583
8622
  exports.register = register;
8584
8623
  exports.registerComponent = registerComponent;