@lwc/template-compiler 7.2.2 → 7.2.3

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.js CHANGED
@@ -13146,6 +13146,8 @@ function serializeAttrs(element, codeGen) {
13146
13146
  if (name === 'spellcheck' && typeof v === 'string' && !hasExpression) {
13147
13147
  v = String(v.toLowerCase() !== 'false');
13148
13148
  }
13149
+ // See W-16614169
13150
+ const escapedAttributeName = templateStringEscape(name);
13149
13151
  if (typeof v === 'string') {
13150
13152
  // IDs/IDRefs must be handled dynamically at runtime due to synthetic shadow scoping.
13151
13153
  // Skip serializing here and handle it as if it were a dynamic attribute instead.
@@ -13154,10 +13156,12 @@ function serializeAttrs(element, codeGen) {
13154
13156
  const needsPlaceholder = hasExpression || hasSvgUseHref || needsScoping;
13155
13157
  // Inject a placeholder where the staticPartId will go when an expression occurs.
13156
13158
  // This is only needed for SSR to inject the expression value during serialization.
13157
- attrs.push(needsPlaceholder ? `\${"${v}"}` : ` ${name}="${htmlEscape(v, true)}"`);
13159
+ attrs.push(needsPlaceholder
13160
+ ? `\${"${v}"}`
13161
+ : ` ${escapedAttributeName}="${htmlEscape(v, true)}"`);
13158
13162
  }
13159
13163
  else {
13160
- attrs.push(` ${name}`);
13164
+ attrs.push(` ${escapedAttributeName}`);
13161
13165
  }
13162
13166
  };
13163
13167
  element.attributes
@@ -13253,7 +13257,9 @@ function serializeStaticElement(element, codeGen) {
13253
13257
  const { name: tagName, namespace } = element;
13254
13258
  const isForeignElement = namespace !== HTML_NAMESPACE;
13255
13259
  const hasChildren = element.children.length > 0;
13256
- let html = `<${tagName}${serializeAttrs(element, codeGen)}`;
13260
+ // See W-16469970
13261
+ const escapedTagName = templateStringEscape(tagName);
13262
+ let html = `<${escapedTagName}${serializeAttrs(element, codeGen)}`;
13257
13263
  if (isForeignElement && !hasChildren) {
13258
13264
  html += '/>';
13259
13265
  return html;
@@ -13262,7 +13268,7 @@ function serializeStaticElement(element, codeGen) {
13262
13268
  const children = transformStaticChildren(element, codeGen.preserveComments);
13263
13269
  html += serializeChildren(children, tagName, codeGen);
13264
13270
  if (!isVoidElement(tagName, namespace) || hasChildren) {
13265
- html += `</${tagName}>`;
13271
+ html += `</${escapedTagName}>`;
13266
13272
  }
13267
13273
  return html;
13268
13274
  }
@@ -14233,7 +14239,12 @@ function transform(codeGen) {
14233
14239
  }
14234
14240
  else if (isIf(child)) {
14235
14241
  const children = transformIf(child);
14236
- Array.isArray(children) ? res.push(...children) : res.push(children);
14242
+ if (Array.isArray(children)) {
14243
+ res.push(...children);
14244
+ }
14245
+ else {
14246
+ res.push(children);
14247
+ }
14237
14248
  }
14238
14249
  else if (isBaseElement(child)) {
14239
14250
  const slotParentName = isSlot(parent) ? parent.slotName : undefined;
@@ -14683,5 +14694,5 @@ function compile(source, filename, config) {
14683
14694
  }
14684
14695
 
14685
14696
  export { ElementDirectiveName, LWCDirectiveDomMode, LWCDirectiveRenderMode, LwcTagName, RootDirectiveName, TemplateDirectiveName, compile, compile as default, kebabcaseToCamelcase, parse, toPropertyName };
14686
- /** version: 7.2.2 */
14697
+ /** version: 7.2.3 */
14687
14698
  //# sourceMappingURL=index.js.map