Merge pull request #1969 from sveltejs/gh-1852

better handling of bare attribute names in DOM mode
pull/1983/head
Rich Harris 6 years ago committed by GitHub
commit efa7ad64c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -0,0 +1,3 @@
export default {
html: '<div potato=""></div>'
};
Loading…
Cancel
Save