You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e7eafd7
Browse filesBrowse the repository at this point in the historyBrowse files
Notice that the binding is to the `disabled`property of the button's DOM element,
403
-
**not** the attribute. This applies to data-binding in general. Data-binding works with *properties* of DOM elements, components, and directives, not HTML *attributes*.
402
+
バインディングの対象は、ボタンの DOM 要素の `disabled`プロパティで、属性 **ではない** ことに注意してください。
This general rule can help you build a mental model of attributes and DOM properties:
427
-
**Attributes initialize DOM properties and then they are done.
428
-
Property values can change; attribute values can't.**
426
+
この一般的なルールは、属性と DOM プロパティのメンタルモデルを構築するのに役立ちます:
427
+
**属性は DOM プロパティを初期化するとその役割を終えます。
428
+
プロパティは変化します。属性は変化しません。**
429
429
430
-
There is one exception to this rule.
431
-
Attributes can be changed by `setAttribute()`, which re-initializes corresponding DOM properties.
430
+
このルールにはひとつだけ例外があります。
431
+
属性は `setAttribute()` で変えることができ、それによって対応する DOM プロパティも再初期化されます。
432
432
433
433
</div>
434
434
435
-
For more information, see the[MDN Interfaces documentation](https://developer.mozilla.org/en-US/docs/Web/API#Interfaces)which has API docs for all the standard DOM elements and their properties.
436
-
Comparing the [`<td>`attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td)attributes to the [`<td>`properties](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement)provides a helpful example for differentiation.
437
-
In particular, you can navigate from the attributes page to the properties via "DOM interface" link, and navigate the inheritance hierarchy up to `HTMLTableCellElement`.
435
+
詳しくは、全ての標準 DOM 要素やそのプロパティについての API ドキュメントがある[MDN Interfaces documentation](https://developer.mozilla.org/en-US/docs/Web/API#Interfaces)を参照してください。
When the user enters "Sally" into the `<input>`, the DOM element`value`*property* becomes "Sally".
450
-
However, if you look at the HTML attribute `value` using `input.getAttribute('value')`, you can see that the *attribute* remains unchanged—it returns "Sarah".
しかし、`input.getAttribute('value')` で HTML の `value` 属性を見れば分かる通り、 *属性* は変わらず「Sarah」のままです。
451
451
452
-
The HTML attribute`value`specifies the *initial* value; the DOM `value`property is the *current* value.
452
+
HTML 属性の`value`は *初期値* を指定します。DOM の `value`プロパティは *現在* の値です。
453
453
454
-
To see attributes versus DOM properties in a functioning app, see the <live-examplename="binding-syntax"></live-example> especially for binding syntax.
454
+
実際に動くアプリで属性と DOM プロパティの違いを見るには、<live-examplename="binding-syntax"></live-example> のバインディング構文を見てください。
455
455
456
-
#### Example 2: a disabled button
456
+
#### 例 2: disabled ボタン
457
457
458
-
The `disabled`attribute is another example. A button's `disabled`
459
-
*property* is`false`by default so the button is enabled.
To control the state of the button, set the `disabled`*property*,
473
+
ボタンの状態を制御するには `disabled`*プロパティ* を設定します。
474
474
475
475
<divclass="alert is-helpful">
476
476
477
-
Though you could technically set the `[attr.disabled]`attribute binding, the values are different in that the property binding requires to a boolean value, while its corresponding attribute binding relies on whether the value is `null`or not. Consider the following:
To see the `disabled`button example in a functioning app, see the <live-examplename="binding-syntax"></live-example> especially for binding syntax. This example shows you how to toggle the disabled property from the component.
0 commit comments