8000 Boolean values in custom data html attributes · Issue #5860 · vuejs/vue · GitHub
[go: up one dir, main page]

Skip to content

Boolean values in custom data html attributes #5860

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

Closed
luarx opened this issue Jun 12, 2017 · 2 comments
Closed

Boolean values in custom data html attributes #5860

luarx opened this issue Jun 12, 2017 · 2 comments

Comments

@luarx
Copy link
luarx commented Jun 12, 2017

What problem does this feature solve?

When there is a html element with a custom data attribute like:

<div :data-opened="false">My content</div>

Vue renders it like:

<div>My content</div>

And I expect that it would be:

<div data-opened="false">My content</div>

Issue #2169 solves the problem with the other types of html attributes, but it is valid that data- attributes can have any string value like "false" and "true".

What does the proposed API look like?

I propose that custom data attributes could have any string value and boolean logic only will apply to the rest of html boolean attributes.

@posva
Copy link
Member
posva commented Jun 12, 2017

If you really want to have the false string as the value you can just pass it as a string instead of a boolean. Booleans will toggle the attribute on the element because that's the most convenient in most cases

@posva posva closed this as completed Jun 12, 2017
@luarx
Copy link
Author
luarx commented Jun 28, 2017

I agree with your answer, thank you very much!

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

No branches or pull requests

2 participants
0