Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 data attributes without value outputting as "true" #2804

Merged
merged 1 commit into from
May 21, 2019

Conversation

kaisermann
Copy link
Member

Closes #2803

@Conduitry
Copy link
Member

I guess data attributes are always strings? I'm not sure whether it makes sense to distinguish between data-foo and data-foo={true}, nor whether that's even possible with the current AST. If not doing that is good enough for other attributes, it's probably good enough here.

@loilo
Copy link

loilo commented May 17, 2019

Data attributes, just like all HTML attributes, are always strings. When having <div data-foo foo></div>, data-foo and foo both equal the empty string. IMO casting them to booleans is fine — it's an established practice and even done in the "official" implementations (e.g. with the checked, selected and disabled DOM properties).

@Rich-Harris Rich-Harris merged commit 931c080 into sveltejs:master May 21, 2019
@kaisermann kaisermann deleted the fix/dataset-without-value branch February 6, 2020 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data attribute without value is assigned the string "true"
4 participants