Skip to content

Commit

Permalink
Merge pull request #2804 from kaisermann/fix/dataset-without-value
Browse files Browse the repository at this point in the history
fix: 🐛 data attributes without value outputting as "true"
  • Loading branch information
Rich-Harris authored May 21, 2019
2 parents 394a166 + 335f77c commit 931c080
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compile/render-dom/wrappers/Element/Attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default class AttributeWrapper {
: property_name
? `${element.var}.${property_name} = ${value};`
: is_dataset
? `${element.var}.dataset.${camel_case_name} = ${value};`
? `${element.var}.dataset.${camel_case_name} = ${value === true ? '""' : value};`
: `${method}(${element.var}, "${name}", ${value === true ? '""' : value});`
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
html: '<div data-potato=""></div>',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div data-potato></div>

0 comments on commit 931c080

Please sign in to comment.