From b95fd53c6ee4c25d123f9e86f4bf5fbc378d181d Mon Sep 17 00:00:00 2001 From: gdennie Date: Tue, 19 Nov 2013 12:34:19 -0500 Subject: docs(booleanAtts): explain the motivation for boolean attributes It was not explicitly and consistently stated that the transient nature of boolean attributes precludes them from hosting binding expressions. This change make that more clear and reinforces the simplicity and elegance of the solution. Closes #5031 --- src/ng/directive/booleanAttrs.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js index 1cd6d10a..7db60a5d 100644 --- a/src/ng/directive/booleanAttrs.js +++ b/src/ng/directive/booleanAttrs.js @@ -149,8 +149,11 @@ * * The HTML specification does not require browsers to preserve the values of boolean attributes * such as disabled. (Their presence means true and their absence means false.) - * This prevents the Angular compiler from retrieving the binding expression. + * If we put an Angular interpolation expression into such an attribute then the + * binding information would be lost when the browser removes the attribute. * The `ngDisabled` directive solves this problem for the `disabled` attribute. + * This complementary directive is not removed by the browser and so provides + * a permanent reliable place to store the binding information. * * @example @@ -181,8 +184,11 @@ * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as checked. (Their presence means true and their absence means false.) - * This prevents the Angular compiler from retrieving the binding expression. + * If we put an Angular interpolation expression into such an attribute then the + * binding information would be lost when the browser removes the attribute. * The `ngChecked` directive solves this problem for the `checked` attribute. + * This complementary directive is not removed by the browser and so provides + * a permanent reliable place to store the binding information. * @example @@ -212,8 +218,12 @@ * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as readonly. (Their presence means true and their absence means false.) - * This prevents the Angular compiler from retrieving the binding expression. + * If we put an Angular interpolation expression into such an attribute then the + * binding information would be lost when the browser removes the attribute. * The `ngReadonly` directive solves this problem for the `readonly` attribute. + * This complementary directive is not removed by the browser and so provides + * a permanent reliable place to store the binding information. + * @example @@ -243,8 +253,11 @@ * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as selected. (Their presence means true and their absence means false.) - * This prevents the Angular compiler from retrieving the binding expression. + * If we put an Angular interpolation expression into such an attribute then the + * binding information would be lost when the browser removes the attribute. * The `ngSelected` directive solves this problem for the `selected` atttribute. + * This complementary directive is not removed by the browser and so provides + * a permanent reliable place to store the binding information. * @example @@ -276,8 +289,12 @@ * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as open. (Their presence means true and their absence means false.) - * This prevents the Angular compiler from retrieving the binding expression. + * If we put an Angular interpolation expression into such an attribute then the + * binding information would be lost when the browser removes the attribute. * The `ngOpen` directive solves this problem for the `open` attribute. + * This complementary directive is not removed by the browser and so provides + * a permanent reliable place to store the binding information. + * * @example -- cgit v1.2.3