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 boolean attributes #91

merged 1 commit into from Feb 10, 2014


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).

Copy link

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)

Copy link

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
Copy link

Merged! Thanks for the great work! 👍

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
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants