From 00a1310a14c30a9f78de157ab83cd047ff85d055 Mon Sep 17 00:00:00 2001 From: sdras Date: Fri, 10 Nov 2017 06:44:23 -0700 Subject: [PATCH 1/2] clarify falsy conditions for attribute description --- src/v2/guide/syntax.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/v2/guide/syntax.md b/src/v2/guide/syntax.md index 65c84b83fe..025dac613e 100644 --- a/src/v2/guide/syntax.md +++ b/src/v2/guide/syntax.md @@ -54,6 +54,8 @@ It also works for boolean attributes - the attribute will be removed if the cond ``` +This will be removed if the value is `null`, `undefined`, or `false`. `0` and `NaN` will still be displayed. + ### Using JavaScript Expressions So far we've only been binding to simple property keys in our templates. But Vue.js actually supports the full power of JavaScript expressions inside all data bindings: From 255cf8168470959fb12482f0addd840f964a068f Mon Sep 17 00:00:00 2001 From: Chris Fritz Date: Fri, 10 Nov 2017 15:49:49 -0500 Subject: [PATCH 2/2] Tweak v-bind boolean example --- src/v2/guide/syntax.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/v2/guide/syntax.md b/src/v2/guide/syntax.md index 025dac613e..ea7c09deec 100644 --- a/src/v2/guide/syntax.md +++ b/src/v2/guide/syntax.md @@ -42,19 +42,19 @@ The contents of this `div` will be replaced with the value of the `rawHtml` prop ### Attributes -Mustaches cannot be used inside HTML attributes, instead use a [v-bind directive](../api/#v-bind): +Mustaches cannot be used inside HTML attributes. Instead, use a [v-bind directive](../api/#v-bind): ``` html
``` -It also works for boolean attributes - the attribute will be removed if the condition evaluates to a falsy value: +In the case of boolean attributes, where their mere existence implies `true`, `v-bind` works a little differently. In this example: ``` html ``` -This will be removed if the value is `null`, `undefined`, or `false`. `0` and `NaN` will still be displayed. +If `isButtonDisabled` has the value of `null`, `undefined`, or `false`, the `disabled` attribute will not even be included in the rendered `