Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b95fd53

Browse files
gdenniepetebacondarwin
authored andcommitted
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
1 parent c77dd04 commit b95fd53

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/ng/directive/booleanAttrs.js

+22-5
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,11 @@
149149
*
150150
* The HTML specification does not require browsers to preserve the values of boolean attributes
151151
* such as disabled. (Their presence means true and their absence means false.)
152-
* This prevents the Angular compiler from retrieving the binding expression.
152+
* If we put an Angular interpolation expression into such an attribute then the
153+
* binding information would be lost when the browser removes the attribute.
153154
* The `ngDisabled` directive solves this problem for the `disabled` attribute.
155+
* This complementary directive is not removed by the browser and so provides
156+
* a permanent reliable place to store the binding information.
154157
*
155158
* @example
156159
<doc:example>
@@ -181,8 +184,11 @@
181184
* @description
182185
* The HTML specification does not require browsers to preserve the values of boolean attributes
183186
* such as checked. (Their presence means true and their absence means false.)
184-
* This prevents the Angular compiler from retrieving the binding expression.
187+
* If we put an Angular interpolation expression into such an attribute then the
188+
* binding information would be lost when the browser removes the attribute.
185189
* The `ngChecked` directive solves this problem for the `checked` attribute.
190+
* This complementary directive is not removed by the browser and so provides
191+
* a permanent reliable place to store the binding information.
186192
* @example
187193
<doc:example>
188194
<doc:source>
@@ -212,8 +218,12 @@
212218
* @description
213219
* The HTML specification does not require browsers to preserve the values of boolean attributes
214220
* such as readonly. (Their presence means true and their absence means false.)
215-
* This prevents the Angular compiler from retrieving the binding expression.
221+
* If we put an Angular interpolation expression into such an attribute then the
222+
* binding information would be lost when the browser removes the attribute.
216223
* The `ngReadonly` directive solves this problem for the `readonly` attribute.
224+
* This complementary directive is not removed by the browser and so provides
225+
* a permanent reliable place to store the binding information.
226+
217227
* @example
218228
<doc:example>
219229
<doc:source>
@@ -243,8 +253,11 @@
243253
* @description
244254
* The HTML specification does not require browsers to preserve the values of boolean attributes
245255
* such as selected. (Their presence means true and their absence means false.)
246-
* This prevents the Angular compiler from retrieving the binding expression.
256+
* If we put an Angular interpolation expression into such an attribute then the
257+
* binding information would be lost when the browser removes the attribute.
247258
* The `ngSelected` directive solves this problem for the `selected` atttribute.
259+
* This complementary directive is not removed by the browser and so provides
260+
* a permanent reliable place to store the binding information.
248261
* @example
249262
<doc:example>
250263
<doc:source>
@@ -276,8 +289,12 @@
276289
* @description
277290
* The HTML specification does not require browsers to preserve the values of boolean attributes
278291
* such as open. (Their presence means true and their absence means false.)
279-
* This prevents the Angular compiler from retrieving the binding expression.
292+
* If we put an Angular interpolation expression into such an attribute then the
293+
* binding information would be lost when the browser removes the attribute.
280294
* The `ngOpen` directive solves this problem for the `open` attribute.
295+
* This complementary directive is not removed by the browser and so provides
296+
* a permanent reliable place to store the binding information.
297+
281298
*
282299
* @example
283300
<doc:example>

0 commit comments

Comments
 (0)