* [CODE(DOMa)@en[defaultValue]] [[DOM属性]] (HTML)
[2] 仕様書:
- [[Web Forms 2.0]]
-- [CSECTION@en[2.4 Extensions to the [CODE(HTMLe)@en[[[input]]]] element]]
<IW:WF2:"#extensions">
-- [CSECTION@en[2.13. The [CODE(HTMLe)@en[[[output]]]] element]]
<IW:WF2:"#the-output">
-- [CSECTION@en[2.18. Handling unexpected elements and values]]
<IW:WF2:"#handling">
** [CODE(HTMLe)@en[input]]

[1]
[CODE(HTMLa)@en[[[value]]]] [[属性]]により[[既定値]]が指定されているものの、
それが[[妥当]]な書式でない場合であっても、
[CODE(DOMa)@en[[[defaultValue]]]] は与えられた値を持ちます。
ただし、[[フォーム制御子]]としては
[CODE(HTMLa)@en[[[value]]]] [[内容属性]]に[[値]]が与えられなかった場合のように振舞います。
([CODE(HTML)@en[[[range]]]] の場合は [CODE(HTMLa)@en[[[min]]]]
の値、それ以外の場合は[[値が選択されていない]]状態です。)
[SRC@en[WF2 2.4]]

[[#comment]]

** [CODE(HTMLe)@en[textarea]]

[7] '''読み取り'''

[CODE(DOMa)@en[[[textContent]]]] と同じです。
[SRC@en[WF2 2.18]]

[8] '''書き込み'''

[CODE(DOMa)@en[[[textContent]]]] と同じです。
[SRC@en[WF2 2.18]]

[9] '''[CODE(DOMa)@en[value]] との関係'''

[CODE(DOMa)@en[[[defaultValue]]]] は、
[CODE(DOMa)@en[[[value]]]] [[DOM属性]]の[[初期値]]として使われます。
[SRC@en[WF2 2.18]]

[[#comment]]

** [CODE(HTMLe)@en[output]]

[3] [CODE(HTMLe)@en[[[output]]]] [[要素]]の[[初期値]]は
[DFN[[CODE(DOMa)@en[[[defaultValue]]]] [[DOM属性]]]]により定義されます。
[SRC@en[WF2 2.13]]

[6]
:状態:[[WHATWG]] [[WD]]
:[[DOM界面]]:[CODE(DOMi)@en[[[HTMLOutputElement]]]]
:[[属性名]]:[CODE(DOMa)@en[[[defaultValue]]]]
([Q@en[default value]] ([Q[[[既定値]]]]) より)
:[[データ型]]:[CODE(DOM)@en[[[DOMString]]]]
:[[例外]]:なし
:[[読取専用]]:[[偽]]

[4] '''初期状態'''

はじめは、[[空文字列]]と[['''しなければなりません''']]。
[[文書]]の[[構文解析]]時に [[DOM]]
[[木]]に追加された [CODE(HTMLe)@en[[[output]]]]
[[要素]]の場合、すべての[[子供節点]]の[[構文解析]]が完了した後、
[CODE(DOMa)@en[[[textContent]]]] [[DOM属性]]の値を
[CODE(DOMa)@en[[[defaultValue]]]] と[['''しなければなりません''']]。
[SRC@en[WF2 2.13, 2.18]]

;;
[5]
[[要素]]の[[内容]]の全体の[[構文解析]]が終わる前に
[CODE(DOMa)@en[[[defaultValue]]]] が[[参照]]された場合や、
[CODE(HTMLe)@en[[[output]]]] が動的に生成された場合には、
[CODE(DOMa)@en[[[defaultValue]]]] が返す値は[[空文字列]]とし[[''なければなりません''']]。
[SRC@en[WF2 2.13]]

[[#comment]]

* メモ

[10] [CITE@en-GB-x-Hixie[Web Forms 2.0]]
([TIME[2009-01-05 20:07:15 +09:00]] 版)
<http://www.whatwg.org/specs/web-forms/current-work/#defaultvalue>

[11] [CITE@en-GB-x-Hixie[Web Forms 2.0]]
([TIME[2009-01-05 20:07:15 +09:00]] 版)
<http://www.whatwg.org/specs/web-forms/current-work/#the-defaultvalue>

[12] [CITE@en[Formalize custom element reactions · whatwg/html@27aa7bc]]
([TIME[2016-04-26 18:57:12 +09:00]] 版)
<https://github.com/whatwg/html/commit/27aa7bc4fa6f168654a8c858f0773e611f679b39>

[13] [CITE@en[Update textarea textContent/defaultValue/value interaction]]
([[domenic]]著, [TIME[2017-06-16 05:46:10 +09:00]])
<https://github.com/whatwg/html/commit/5afbba1cf62ee01bc6af3fd220d01f3f7591a0fc>

[14] [CITE@en[Textarea defaultValue handling doesn't really match UAs (who don't match each other) when there are child elements · Issue #2752 · whatwg/html]]
([TIME[2017-06-29 17:19:36 +09:00]])
<https://github.com/whatwg/html/issues/2752>

[15] [CITE@en[Update textarea textContent/defaultValue/value interaction by domenic · Pull Request #2766 · whatwg/html]]
([TIME[2017-06-29 17:20:49 +09:00]])
<https://github.com/whatwg/html/pull/2766>

[16] [CITE@en[Rewrite output element to not use non-existing observers]]
([[annevk]]著, [TIME[2019-04-03 20:17:00 +09:00]])
<https://github.com/whatwg/html/commit/3419d36fba06332547b7a05b8e2ab6c0b1fae64b>

[17] [CITE@en[The output element's default value · Issue #4163 · whatwg/html]]
([TIME[2019-09-10 09:48:41 +09:00]])
<https://github.com/whatwg/html/issues/4163>

[18] [CITE@en[Rewrite output element to not use non-existing observers by annevk · Pull Request #4447 · whatwg/html]]
([TIME[2019-09-10 09:50:28 +09:00]])
<https://github.com/whatwg/html/pull/4447>

[19] [CITE@en[Stop using textContent in normative text]]
([[annevk]]著, [TIME[2019-04-04 17:23:13 +09:00]])
<https://github.com/whatwg/html/commit/ec860d872de3712277242655562a4d2a1325592a>