diff --git a/src/compile/render-dom/wrappers/Element/Attribute.ts b/src/compile/render-dom/wrappers/Element/Attribute.ts index 769eeb8d53..bec0fa35a4 100644 --- a/src/compile/render-dom/wrappers/Element/Attribute.ts +++ b/src/compile/render-dom/wrappers/Element/Attribute.ts @@ -187,7 +187,7 @@ export default class AttributeWrapper { ? `${element.var}.${propertyName} = ${value};` : isDataSet ? `${element.var}.dataset.${camelCaseName} = ${value};` - : `${method}(${element.var}, "${name}", ${value});` + : `${method}(${element.var}, "${name}", ${value === true ? '""' : value});` ); block.builders.hydrate.addLine(statement); @@ -207,9 +207,9 @@ export default class AttributeWrapper { } stringify() { - const value = this.node.chunks; + if (this.node.isTrue) return ''; - if (value === true) return ''; + const value = this.node.chunks; if (value.length === 0) return `=""`; return `="${value.map(chunk => { diff --git a/test/runtime/samples/attribute-unknown-without-value/_config.js b/test/runtime/samples/attribute-unknown-without-value/_config.js new file mode 100644 index 0000000000..4f7cf1cbbf --- /dev/null +++ b/test/runtime/samples/attribute-unknown-without-value/_config.js @@ -0,0 +1,3 @@ +export default { + html: '
' +}; \ No newline at end of file diff --git a/test/runtime/samples/attribute-unknown-without-value/main.html b/test/runtime/samples/attribute-unknown-without-value/main.html new file mode 100644 index 0000000000..0952586580 --- /dev/null +++ b/test/runtime/samples/attribute-unknown-without-value/main.html @@ -0,0 +1 @@ + \ No newline at end of file