Skip to content

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, I have tested locally and it's looking good. Just one final thing: please do not include the /dist files in the commits. If you can reset and make a single clean commit without the /dist files it will be good to merge. (You can just push -f to your current branch)

@th0r
Copy link
Author

th0r commented Feb 9, 2014

@yyx990803 Fixed! =)

yyx990803 added a commit that referenced this pull request Feb 10, 2014
@yyx990803 yyx990803 merged commit 1946a51 into vuejs:dev Feb 10, 2014
@yyx990803
Copy link
Member

Merged! Thanks for the great work! 👍

@kristoferjoseph
Copy link

🍻 I just ran into this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants