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
merged 1 commit into from Feb 10, 2014
Merged

Support boolean attributes #91

merged 1 commit into from Feb 10, 2014

Conversation

@th0r
Copy link

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

yyx990803 commented Feb 9, 2014

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

yyx990803 commented Feb 10, 2014

Merged! Thanks for the great work! 👍

@kristoferjoseph
Copy link

kristoferjoseph commented Feb 10, 2014

🍻 I just ran into this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.