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

Support for boolean HTML-attributes #90

Closed
wants to merge 3 commits into from

Conversation

th0r
Copy link

@th0r th0r commented Feb 9, 2014

Current v-attr implementation doesn't support boolean attributes (e.g. disabled).
Here is the common use-case:

<button type="submit" v-attr="disabled: !submittionAllowed">

It doesn't work because v-attr uses this.el.setAttribute method. So, when submittionAllowed equals to true, then submit button will look like this:

<button type="submit" disabled="false">

...which is treated by browser as disabled button.
My proposal is to remove current attribute if it's value is falsy (except zero).

@yyx990803
Copy link
Member

Hi Yuriy, great suggestion. If you have time, could you please make sure tests are updated and passed according to the contribution guide? Thanks.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 7bb8ef1 on th0r:boolean-attrs-support into c71c6a4 on yyx990803:master.

@yyx990803 yyx990803 closed this Feb 9, 2014
Hanks10100 pushed a commit to Hanks10100/vue that referenced this pull request May 6, 2018
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.

None yet

3 participants