better handling of bare attribute names in DOM mode (#1852)

- compile unknown bare attribute names to setting the attribute to ""
- correctly stringify as bare attribute name in .innerHTML'd markup
pull/1969/head
Conduitry 6 years ago
parent 88b6a26a35
commit e97953baec

@ -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 => {

Loading…
Cancel
Save