diff --git a/packages/@lwc/engine-core/src/framework/api.ts b/packages/@lwc/engine-core/src/framework/api.ts index aac963614a..333f123a18 100644 --- a/packages/@lwc/engine-core/src/framework/api.ts +++ b/packages/@lwc/engine-core/src/framework/api.ts @@ -52,13 +52,13 @@ function addVNodeToChildLWC(vnode: VCustomElement) { } // [st]atic node -function st(hoisted: Element, html: string, key: Key): VStatic { +function st(elmProto: Element, key: Key): VStatic { return { type: VNodeType.Static, sel: undefined, key, elm: undefined, - elmProto: hoisted, + elmProto, owner: getVMBeingRendered()!, }; } diff --git a/packages/@lwc/engine-core/src/framework/rendering.ts b/packages/@lwc/engine-core/src/framework/rendering.ts index 91a96b3139..b9d22e90d9 100644 --- a/packages/@lwc/engine-core/src/framework/rendering.ts +++ b/packages/@lwc/engine-core/src/framework/rendering.ts @@ -222,7 +222,7 @@ function mountStatic(vnode: VStatic, parent: ParentNode, anchor: Node | null) { } if (process.env.NODE_ENV !== 'production') { - const isLight = owner.renderMode === RenderMode.Light; + const isLight = renderMode === RenderMode.Light; patchElementWithRestrictions(elm, { isPortal: false, isLight }); } @@ -357,7 +357,7 @@ function observeElementChildNodes(elm: Element) { (elm as any).$domManual$ = true; } -export function setElementShadowToken(elm: Element, token: string) { +function setElementShadowToken(elm: Element, token: string) { (elm as any).$shadowToken$ = token; } diff --git a/packages/@lwc/engine-core/src/framework/template.ts b/packages/@lwc/engine-core/src/framework/template.ts index 5ff9088bff..0d76c4ce88 100644 --- a/packages/@lwc/engine-core/src/framework/template.ts +++ b/packages/@lwc/engine-core/src/framework/template.ts @@ -55,8 +55,6 @@ export interface Template { stylesheetToken?: string; /** Render mode for the template. Could be light or undefined (which means it's shadow) */ renderMode?: 'light'; - /** Hoisted Fragments */ - hoistedFragments?: Node[]; } export let isUpdatingTemplate: boolean = false; @@ -127,21 +125,21 @@ export function parseFragment(strings: string[], ...keys: number[]): () => Eleme const attrToken = stylesheetToken && shadowMode === ShadowMode.Synthetic ? stylesheetToken : '""'; - const genHtmlFragment: string[] = []; + const htmlFragments: string[] = []; for (let i = 0, n = keys.length; i < n; i++) { switch (keys[i]) { case 0: - genHtmlFragment.push(strings[i], classToken); + htmlFragments.push(strings[i], classToken); break; case 1: - genHtmlFragment.push(strings[i], attrToken); + htmlFragments.push(strings[i], attrToken); break; } } - genHtmlFragment.push(strings[strings.length - 1]); + htmlFragments.push(strings[strings.length - 1]); - return createFragment(genHtmlFragment.join('')); + return createFragment(htmlFragments.join('')); }; } diff --git a/packages/@lwc/template-compiler/src/codegen/codegen.ts b/packages/@lwc/template-compiler/src/codegen/codegen.ts index 5122588781..63041518fe 100644 --- a/packages/@lwc/template-compiler/src/codegen/codegen.ts +++ b/packages/@lwc/template-compiler/src/codegen/codegen.ts @@ -12,7 +12,6 @@ import { NormalizedConfig } from '../config'; import * as t from '../shared/estree'; import { BaseElement, - BaseParentNode, ChildNode, Element, Expression, @@ -25,7 +24,6 @@ import { isBaseElement, isComment, isComponent, - isIf, isPreserveCommentsDirective, isRenderModeDirective, isSlot, @@ -89,7 +87,7 @@ interface Scope { function getStaticNodes(root: Root): Set { const hoistedNodes = new Set(); - function isStaticNode(node: BaseElement, parent: BaseParentNode): boolean { + function isStaticNode(node: BaseElement): boolean { let result = true; const { name: nodeName, @@ -100,7 +98,6 @@ function getStaticNodes(root: Root): Set { listeners, } = node; - result &&= !isIf(parent); // when parent node is an if, this element output is bound to some component value. result &&= !isSlot(node); // slot element can't be static. result &&= !isComponent(node); // components are not static. @@ -127,9 +124,9 @@ function getStaticNodes(root: Root): Set { return result; } - function collectStaticNodes(node: ChildNode, parent: BaseParentNode) { + function collectStaticNodes(node: ChildNode) { let childrenAreStatic = true; - let nodeIsStatic = true; + let nodeIsStatic; if (isText(node)) { nodeIsStatic = isLiteral(node.value); @@ -138,12 +135,12 @@ function getStaticNodes(root: Root): Set { } else { // it is ForBlock | If | BaseElement node.children.forEach((childNode) => { - collectStaticNodes(childNode, node); + collectStaticNodes(childNode); childrenAreStatic = childrenAreStatic && hoistedNodes.has(childNode); }); - nodeIsStatic = isBaseElement(node) && isStaticNode(node, parent); + nodeIsStatic = isBaseElement(node) && isStaticNode(node); } if (nodeIsStatic && childrenAreStatic) { @@ -155,7 +152,7 @@ function getStaticNodes(root: Root): Set { } } - root.children.forEach((childNode) => collectStaticNodes(childNode, root)); + root.children.forEach((childNode) => collectStaticNodes(childNode)); return hoistedNodes; } diff --git a/packages/integration-karma/test/api/sanitizeAttribute/x/xlink/xlink.js b/packages/integration-karma/test/api/sanitizeAttribute/x/xlink/xlink.js index 784f7f785c..f4511e2fb6 100644 --- a/packages/integration-karma/test/api/sanitizeAttribute/x/xlink/xlink.js +++ b/packages/integration-karma/test/api/sanitizeAttribute/x/xlink/xlink.js @@ -1,5 +1,5 @@ import { LightningElement } from 'lwc'; export default class Xlink extends LightningElement { - href = "/foo"; + href = '/foo'; }