@vojtaholik/static-kit-core 2.1.12 → 2.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vojtaholik/static-kit-core",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -255,9 +255,10 @@ function compileElement(element: Element, indent: number): string {
255
255
  continue;
256
256
  }
257
257
  // Conditionally render attribute only if value is truthy
258
- code += `${pad}const _${attrName}Val = ${attr.value};\n`;
259
- code += `${pad}if (_${attrName}Val) {\n`;
260
- code += `${pad} out += " ${attrName}=\\"" + escapeAttr(_${attrName}Val) + "\\"";\n`;
258
+ const varName = attrName.replace(/[^a-zA-Z0-9_]/g, "_");
259
+ code += `${pad}const _${varName}Val = ${attr.value};\n`;
260
+ code += `${pad}if (_${varName}Val) {\n`;
261
+ code += `${pad} out += " ${attrName}=\\"" + escapeAttr(_${varName}Val) + "\\"";\n`;
261
262
  code += `${pad}}\n`;
262
263
  }
263
264
  }