@lwc/template-compiler 7.2.1 → 7.2.3-alpha.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.
- package/dist/index.cjs.js +18 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -11927,7 +11927,7 @@ function getTemplateRoot(ctx, documentFragment) {
|
|
|
11927
11927
|
(isTextNode$1(child) && child.value.trim().length));
|
|
11928
11928
|
if (validRoots.length > 1) {
|
|
11929
11929
|
const duplicateRoot = validRoots[1].sourceCodeLocation ?? undefined;
|
|
11930
|
-
ctx.throw(errors.ParserDiagnostics.MULTIPLE_ROOTS_FOUND, [], duplicateRoot ? sourceLocation(duplicateRoot) : duplicateRoot ?? undefined);
|
|
11930
|
+
ctx.throw(errors.ParserDiagnostics.MULTIPLE_ROOTS_FOUND, [], duplicateRoot ? sourceLocation(duplicateRoot) : (duplicateRoot ?? undefined));
|
|
11931
11931
|
}
|
|
11932
11932
|
const [root] = validRoots;
|
|
11933
11933
|
if (!root || !isElementNode(root)) {
|
|
@@ -13170,6 +13170,8 @@ function serializeAttrs(element, codeGen) {
|
|
|
13170
13170
|
if (name === 'spellcheck' && typeof v === 'string' && !hasExpression) {
|
|
13171
13171
|
v = String(v.toLowerCase() !== 'false');
|
|
13172
13172
|
}
|
|
13173
|
+
// See W-16614169
|
|
13174
|
+
const escapedAttributeName = templateStringEscape(name);
|
|
13173
13175
|
if (typeof v === 'string') {
|
|
13174
13176
|
// IDs/IDRefs must be handled dynamically at runtime due to synthetic shadow scoping.
|
|
13175
13177
|
// Skip serializing here and handle it as if it were a dynamic attribute instead.
|
|
@@ -13178,10 +13180,12 @@ function serializeAttrs(element, codeGen) {
|
|
|
13178
13180
|
const needsPlaceholder = hasExpression || hasSvgUseHref || needsScoping;
|
|
13179
13181
|
// Inject a placeholder where the staticPartId will go when an expression occurs.
|
|
13180
13182
|
// This is only needed for SSR to inject the expression value during serialization.
|
|
13181
|
-
attrs.push(needsPlaceholder
|
|
13183
|
+
attrs.push(needsPlaceholder
|
|
13184
|
+
? `\${"${v}"}`
|
|
13185
|
+
: ` ${escapedAttributeName}="${shared.htmlEscape(v, true)}"`);
|
|
13182
13186
|
}
|
|
13183
13187
|
else {
|
|
13184
|
-
attrs.push(` ${
|
|
13188
|
+
attrs.push(` ${escapedAttributeName}`);
|
|
13185
13189
|
}
|
|
13186
13190
|
};
|
|
13187
13191
|
element.attributes
|
|
@@ -13277,7 +13281,9 @@ function serializeStaticElement(element, codeGen) {
|
|
|
13277
13281
|
const { name: tagName, namespace } = element;
|
|
13278
13282
|
const isForeignElement = namespace !== shared.HTML_NAMESPACE;
|
|
13279
13283
|
const hasChildren = element.children.length > 0;
|
|
13280
|
-
|
|
13284
|
+
// See W-16469970
|
|
13285
|
+
const escapedTagName = templateStringEscape(tagName);
|
|
13286
|
+
let html = `<${escapedTagName}${serializeAttrs(element, codeGen)}`;
|
|
13281
13287
|
if (isForeignElement && !hasChildren) {
|
|
13282
13288
|
html += '/>';
|
|
13283
13289
|
return html;
|
|
@@ -13286,7 +13292,7 @@ function serializeStaticElement(element, codeGen) {
|
|
|
13286
13292
|
const children = transformStaticChildren(element, codeGen.preserveComments);
|
|
13287
13293
|
html += serializeChildren(children, tagName, codeGen);
|
|
13288
13294
|
if (!shared.isVoidElement(tagName, namespace) || hasChildren) {
|
|
13289
|
-
html += `</${
|
|
13295
|
+
html += `</${escapedTagName}>`;
|
|
13290
13296
|
}
|
|
13291
13297
|
return html;
|
|
13292
13298
|
}
|
|
@@ -14257,7 +14263,12 @@ function transform(codeGen) {
|
|
|
14257
14263
|
}
|
|
14258
14264
|
else if (isIf(child)) {
|
|
14259
14265
|
const children = transformIf(child);
|
|
14260
|
-
Array.isArray(children)
|
|
14266
|
+
if (Array.isArray(children)) {
|
|
14267
|
+
res.push(...children);
|
|
14268
|
+
}
|
|
14269
|
+
else {
|
|
14270
|
+
res.push(children);
|
|
14271
|
+
}
|
|
14261
14272
|
}
|
|
14262
14273
|
else if (isBaseElement(child)) {
|
|
14263
14274
|
const slotParentName = isSlot(parent) ? parent.slotName : undefined;
|
|
@@ -14711,5 +14722,5 @@ exports.default = compile;
|
|
|
14711
14722
|
exports.kebabcaseToCamelcase = kebabcaseToCamelcase;
|
|
14712
14723
|
exports.parse = parse;
|
|
14713
14724
|
exports.toPropertyName = toPropertyName;
|
|
14714
|
-
/** version: 7.2.
|
|
14725
|
+
/** version: 7.2.2 */
|
|
14715
14726
|
//# sourceMappingURL=index.cjs.js.map
|