output

output 要素 (HTML)

[1] HTMLoutput 要素は、 DOM 的にはフォーム・制御子である span 要素のようなものです。 WF2 2.13 フォーム利用者が入力した値から算出した値 (例えば電子商取引Webサイト利用者が選択した商品の見積り額) を挿入する場所として使うことが想定されています。

[2]

状態
WHATWG WD
名前空間URI
http://www.w3.org/1999/xhtml
要素型名
output (output (出力) より)
文脈
内容モデル
行内内容 (>>5)
開始タグ
終了タグ
属性
共通属性 (HTML 4 %attrs;)
属性名属性値既定値説明状態出典
forWHATWG WD[WF2]
formIDREFS(文脈依存)フォームWHATWG WD[WF2]
nameWHATWG WD[WF2]
onchangeWHATWG WD[WF2]
onformchangeWHATWG WD[WF2]
onforminputWHATWG WD[WF2]

[3] 仕様書:

状態

[12] HTMLElement の状態に加えて、

htmlFor
DOMTokenList

内容

[5] span 同様、 任意の行内内容が認められます。 WF2 2.13

[11] change 事象

value (>>49)

フォーム

[4] 現在値

内容現在値です。 WF2 2.13

[6] 現在値は、 value DOM属性により読み書きできます。 WF2 2.13

[7] 初期値

初期値は、 defaultValue DOM属性の値です。 WF2 2.13

[8] 成功

output 要素成功することはありません。 WF2 2.13

[9] 再設定

フォーム再設定すると、 output 要素も、 defaultValue DOM属性を用いて再設定されます。 WF2 2.13

defaultValueDOMString なので、 元々子要素があったとしても、 再設定すると要素の構造は消えてしまいます。

関連

[49] WF2 2.13

[10] WF2 2.13

<form>
 <p>
  <input name="a" type="number" step="any" value="0"> *
  <input name="b" type="number" step="any" value="0"> =
  <output name="result" onforminput="value = a.value * b.value">0</output>
 </p>
</form>

レンダリング

+--------+-+   +--------+-+
|      0 |:| * |      0 |:| = 0
+--------+-+   +--------+-+

利用者がいずれかの入力欄のを変更すると、 2つのEQUAL SIGN の右側の output 要素内に現れます。

メモ

メモ

[50] Web Applications 1.0 r7356 Try to be a little looser in <output>'s definition. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7355&to=7356

[51] [whatwg] OUTPUT tag: clarify purpose in spec? ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-January/041901.html

[52] Web Applications 1.0 r8417 Try to clarify <output> and <samp> based on discussions on the WHATWG list ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8416&to=8417

[53] Web Applications 1.0 r4531 Make <progress>, <meter>, and <output> labelable with <label>. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=4530&to=4531

[54] Form Controls ( ( 版)) http://www.w3.org/TR/2001/WD-xforms-20010608/slice7.html#ui-output

[55] Web Applications 1.0 r8839 Fix the attribute index's mention of <track>; mention that <output> doesn't submit. ( ( 版)) https://html5.org/r/8839

[56] [whatwg] Markup-related feedback ( (Ian Hickson 著, 版)) http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Oct/0239.html

[13] dfn what it means for elements to be “referenced” (sideshowbarker著, ) https://github.com/whatwg/html/commit/d0872abf29373f284c93434875e2e30d12602081

[14] Fix example of output element to use ids instead of names (frigus02著, ) https://github.com/whatwg/html/commit/58a8817ee90dff89c9b751bc693764dc0a83c0ce

[15] Example for <output> uses `name` instead of `id` when referring to `for` elements · Issue #3312 · whatwg/html () https://github.com/whatwg/html/issues/3312

[16] Fix example of output element to use ids instead of names by frigus02 · Pull Request #3313 · whatwg/html () https://github.com/whatwg/html/pull/3313

[17] Fix form inheritance behavior for autocapitalize (rlanday著, ) https://github.com/whatwg/html/commit/b7c21b1b56d77215d3d85ae14a072c090dbe6266

[18] leverage CORE mappings / issue #119 (jasonkiss著, ) https://github.com/w3c/html-aam/commit/a1a661d9874e2674cd99b7dda1cf6962dc91df1b

[19] leverage CORE mappings / issue #119 (jasonkiss著, ) https://github.com/w3c/html-aam/commit/a1a661d9874e2674cd99b7dda1cf6962dc91df1b

[20] Rewrite output element to not use non-existing observers (annevk著, ) https://github.com/whatwg/html/commit/3419d36fba06332547b7a05b8e2ab6c0b1fae64b

[21] The output element's default value · Issue #4163 · whatwg/html () https://github.com/whatwg/html/issues/4163

[22] Rewrite output element to not use non-existing observers by annevk · Pull Request #4447 · whatwg/html () https://github.com/whatwg/html/pull/4447