Skip to content

Support boolean attributes#91

Merged
yyx990803 merged 1 commit into
vuejs:devfrom
th0r:boolean-attrs-support
Feb 10, 2014
Merged

Support boolean attributes#91
yyx990803 merged 1 commit into
vuejs:devfrom
th0r:boolean-attrs-support

Conversation

@th0r
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Merged! Thanks for the great work! 👍

@kristoferjoseph
Copy link
Copy Markdown

🍻 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants