【この訳に固有の表記規約】

この訳の,~algoの記述に利用されている各種記号( ~LET, ~IF, ~RET, 等々)の意味や定義の詳細は、~SYMBOL_DEF_REFを~~参照されたし。

4.10.17. ~form~control基盤

4.10.17.1. ~form ~controlの値

ほとんどの~form~controlは、 `値@ と `~checkedness@ を持つ(後者は `input$e 要素のみから利用される)。 これらは、利用者が~controlと対話する方法を記述するために利用される。 ◎ Most form controls have a value and a checkedness. (The latter is only used by input elements.) These are used to describe how the user interacts with the control.

~controlの`値$は、その内部~状態である — なので、利用者の現在の入力に合致しないこともある。 ◎ A control's value is its internal state. As such, it might not match the user's current input.

具体例として、利用者が 数字を期待する `Number$st 欄の中に単語 "three" を手入力した場合、利用者の入力は 文字列 "three" になるが,~controlの`値$は そのまま変化しない。 あるいは、利用者が `Email$st 欄の中へ~e-mail~address " ~awesomeAt" (頭部に空白あり)を手入力した場合、利用者の入力は文字列 ` ~awesomeAt^l になるが,~browserの~UIは それを`値$ `~awesomeAt^l (頭部に空白なし)に翻訳するであろう。 ◎ For instance, if a user enters the word "three" into a numeric field that expects digits, the user's input would be the string "three" but the control's value would remain unchanged. Or, if a user enters the email address " awesome@example.com" (with leading whitespace) into an email field, the user's input would be the string " awesome@example.com" but the browser's UI for email fields might translate that into a value of "awesome@example.com" (without the leading whitespace).

各[ `input$e / `textarea$e ]要素は、 `~dirty値~flag@ を持つ。 これは、要素の[ `値$と既定の値 ]との連関を追跡するために利用される — ~F の下では,`値$は 既定の値を映し出し、 ~T の下では,既定の値は無視される。 ◎ input and textarea elements have a dirty value flag. This is used to track the interaction between the value and default value. If it is false, value mirrors the default value. If it is true, the default value is ignored.

各 `input$e 要素は,別々に定義される `値たち@ も持つ。 それは、要素の `~multipleI$a 属性に対する 拘束検証の挙動を定義するためにある。 ◎ To define the behavior of constraint validation in the face of the input element's multiple attribute, input elements can also have separately defined values.

`値$を伴うすべての~form~controlは、 `~API値@ を得るための~algoも備える。 それは、[ `maxlength$a / `minlength$a ]属性の挙動, および `textarea$e 要素に特有の他の~APIを定義するためにある。 既定では、この~algoは,単純に~controlの`値$を返す。 ◎ To define the behavior of the maxlength and minlength attributes, as well as other APIs specific to the textarea element, all form control with a value also have an algorithm for obtaining an API value. By default this algorithm is to simply return the control's value.

`select$e 要素は、`値$を持たない — 代わりに,その `option$e 要素の`選択有無$optが利用される。 ◎ The select element does not have a value; the selectedness of its option elements is what is used instead.

4.10.17.2. 変異-可能~性

~form~controlは `変異-可能@ として指名され得る。 ◎ A form control can be designated as mutable.

注記: これは,(要素がそう指名されているかどうかに依拠する,この仕様における定義と要件を以って)、利用者が~form~controlの`値$や`~checkedness$を改変できるかどうか,および ~controlは予め自動的に埋められるかどうかを決定する。 ◎ This determines (by means of definitions and requirements in this specification that rely on whether an element is so designated) whether or not the user can modify the value or checkedness of a form control, or whether or not a control can be automatically prefilled.

4.10.17.3. ~controlと~formとの結付け

各 `~formに所有され得る要素$には、[ 要素の `~form所有者@ と呼ばれる,ある `form$e 要素 ]との関係性が与えられ得る。 どの `form$e 要素にも所有されない要素の`~form所有者$は ~NULL とする。 ◎ A form-associated element can have a relationship with a form element, which is called the element's form owner. If a form-associated element is not associated with a form element, its form owner is said to be null.

【 “所有される” — 原文では、単に “結付けられる( associated )” であるが、この訳では “所有-” / “所有され得る” という語で,その結付けを表すことにする。 例えば, “~form %F が所有する要素” とは、`~formに所有され得る要素$であって[ その`~form所有者$ ~EQ %F ]なるもの(または、それらが成す集合)を意味する。 】【 同じ要素が同時に複数の `form$e 要素から所有されることはない。 】

各 `~formに所有され得る要素$には、 `構文解析器挿入~flag@ が結付けられる。 【指定されない限り ~OFF 。】 ◎ A form-associated element has an associated parser inserted flag.

`~formに所有され得る要素$は、既定では,それに最も近い先祖 `form$e 要素に所有される(下に述べる)が、それらのうち`~listされ$る要素には,これを上書きする `form@a 属性が指定されても~MAY。 ◎ A form-associated element is, by default, associated with its nearest ancestor form element (as described below), but, if it is listed, may have a form attribute specified to override this.

注記: この特色機能により、入子の `form$e 要素~用の~supportを欠いている下でも,作者は対処できるようになる。 ◎ This feature allows authors to work around the lack of support for nested form elements.

`~listされ$る要素に指定する `form$a 属性の値は、要素の`木$内にある `form$e 要素の`~ID$で~MUST。 ◎ If a listed form-associated element has a form attribute specified, then that attribute's value must be the ID of a form element in the element's tree.

注記: この節における規則は、複雑になっている — [ 文書/`木$ ]が適合ならば,入子の `form$e 要素を包含することは決してないが、そのような入子の要素を有する`木$を生成することは,事実として全く可能なので(例: ~DOM操作を遂行する~scriptを用いて)。 それまた、~HTML構文解析器における規則によっても複雑になっている — 歴史的~理由から、`~formに所有され得る要素$が,その先祖でない `form$e 要素に所有されることもあるので。 ◎ The rules in this section are complicated by the fact that although conforming documents or trees will never contain nested form elements, it is quite possible (e.g., using a script that performs DOM manipulation) to generate trees that have such nested elements. They are also complicated by rules in the HTML parser that, for historical reasons, can result in a form-associated element being associated with a form element that is not its ancestor.

`~formに所有され得る要素$の作成-時には、その`~form所有者$は,~NULLに(所有者なし)に初期化され~MUST。 ◎ When a form-associated element is created, its form owner must be initialized to null (no owner).

所与の~form %~form に,`~formに所有され得る要素$ %要素 を `所有させる@ ときは、[ %要素 の`~form所有者$ ~SET %~form ]に設定し~MUST。 ◎ When a form-associated element is to be associated with a form, its form owner must be set to that form.

【 この訳では、この用語は利用せず,直接的に “%要素 の`~form所有者$ ~SET %~form” と記すことにする。 】

`~formに所有され得る要素$ %要素 に対し,次が生じたときは、~UAは %要素 の`~form所有者を再設定-$し~MUST: ◎ ↓

  • [ %要素 の`構文解析器挿入~flag$ ~EQ ~ON ]の下で, %要素 または そのいずれかの先祖が`挿入された$nodeとき。 ◎ When a form-associated element or one of its ancestors is inserted, then: • If the form-associated element's parser inserted flag is set, then return. • Reset the form owner of the form-associated element.
  • [ %要素 の`~form所有者$ %所有者 ~NEQ ~NULL ]の下で, %要素 または そのいずれかの先祖が`除去された$node結果、 %要素, %所有者 は同じ`木$内でなくなったとき。 ◎ When a form-associated element or one of its ancestors is removed, then: • If the form-associated element has a form owner and the form-associated element and its form owner are no longer in the same tree, then reset the form owner of the form-associated element.
  • %要素 が`~listされ$る要素であって,その `form$a 属性が[ 設定- / 変更- /除去- ]されたとき。 ◎ When a listed form-associated element's form attribute is set, changed, or removed, then the user agent must reset the form owner of that element.
  • %要素 が`~listされ$る要素であって, `form$a 属性を有している下で:

    • `木$内のある要素の`~ID$が変更されたとき。
    • `~ID$を伴うある要素が,当の`文書$[ の`中へ挿入された$ / `から除去された$ ]とき。
    ◎ When a listed form-associated element has a form attribute and the ID of any of the elements in the tree changes, then the user agent must reset the form owner of that form-associated element. ◎ When a listed form-associated element has a form attribute and an element with an ID is inserted into or removed from the Document, then the user agent must reset the form owner of that form-associated element.

~UAは、`~formに所有され得る要素$ %要素 の `~form所有者を再設定-@ するときは、[ %要素 の`~form所有者$ ~SET ~DOMの改変-後の時点で 次の手続きを走らせた結果 ]にし~MUST:

  1. %要素 の`構文解析器挿入~flag$ ~SET ~OFF
  2. ~IF[ %要素 は`接続されて$いる ]~AND[ %要素 は`~listされ$る要素である ]~AND[ %要素 は `form$a 内容~属性を有する ]~AND[ %要素 の`木$内に[ `~ID$ ~EQ [ %要素 の `form$a 内容~属性の値 ]]なる要素があって,それらのうち`木~順序$で最初のものは `form$e 要素である ] ⇒ ~RET その `form$e 要素
  3. ~IF [ %要素 の先祖に `form$e 要素は在る ] ⇒ ~RET それらのうち %要素 に最も近いもの
  4. ~RET ~NULL

【 この訳では、原文の記述を整理して,等価な結果が得られるよう単純化している。 】

◎ When the user agent is to reset the form owner of a form-associated element element, it must run the following steps: • Unset element's parser inserted flag. • If all of the following conditions are true •• element's form owner is not null •• element is not listed or its form content attribute is not present •• element's form owner is its nearest form element ancestor after the change to the ancestor chain then do nothing, and return. • Set element's form owner to null. • If element is listed, has a form content attribute, and is connected, then: •• If the first element in element's tree, in tree order, to have an ID that is case-sensitively equal to element's form content attribute's value, is a form element, then associate the element with that form element. • Otherwise, if element has an ancestor form element, then associate element with the nearest such ancestor form element.

次の不適合~code片: ◎ In the following non-conforming snippet:

`association-of-controls-and-forms-1^xCode

"d" の`~form所有者$は,内縁の入子の~form "c" になる一方で、 "e" の`~form所有者$は,外縁の~form "a" になる。 ◎ The form owner of "d" would be the inner nested form "c", while the form owner of "e" would be the outer form "a".

これは次のようにして起こる: 先ず,~node "e" は、`~HTML構文解析器$において "c" に結付けられる。 次に,`innerHTML$m ~algoは、~nodeたちを一時的な文書から要素 "b" へ移動する。 各~nodeは、この時点で,各自の先祖の連鎖が変更されたことを見る。 したがって、構文解析器による “魔法の” 結付けすべては、通常の,先祖への結付けに再設定される。 ◎ This happens as follows: First, the "e" node gets associated with "c" in the HTML parser. Then, the innerHTML algorithm moves the nodes from the temporary document to the "b" element. At this point, the nodes see their ancestor chain change, and thus all the "magic" associations done by the parser are reset to normal ancestor associations.

もっとも、この例は不適合な文書である — そこには、入子の `form$e 要素による内容~modelの違反があり,また `</form>^c ~tagにも`構文解析-~error$がある。 ◎ This example is a non-conforming document, though, as it is a violation of the content models to nest form elements, and there is a parse error for the </form> tag.

%element . `form$m
要素の`~form所有者$が[ 在るならば それ / 無いならば ~NULL ]を返す。 ◎ Returns the element's form owner. ◎ Returns null if there isn't one.
`form@m
`~formに所有され得る要素$のうち,`~listされ$るものは、この~IDL属性を有する。 ◎ ↓
取得子は、[ 此れの`~form所有者$ ~NEQ ~NULL ならば それ / ~ELSE_ ~NULL ]を返さ~MUST。 ◎ Listed form-associated elements have a form IDL attribute, which, on getting, must return the element's form owner, or null if there isn't one.

4.10.18. 各種~form~controlに共通の属性

4.10.18.1. ~form~controlの命名: `name^a 属性

`name@a 内容~属性は、~form~controlの名前を与える。 それは、`~form提出$, および `form$e 要素の `elements$m ~objにて利用される。 この属性の値に[ 空~文字列 / `isindex^v ]を指定しては~MUST_NOT。 ◎ The name content attribute gives the name of the form control, as used in form submission and in the form element's elements object. If the attribute is specified, its value must not be the empty string or isindex.

注記: いくつかの~UAは、歴史的に,[ 名前 `isindex^v を伴う “first-in-form” ~text~control ]用に特別な~supportを実装していた。 また,この仕様は、以前は,そのための関係する~UA要件を定義していた。 しかしながら,一部の~UAは、後にその特別な~supportを取りやめたため、関係する要件は この仕様から除去された。 なので、旧来の~UAから再~解釈される問題を避けるため、名前 `isindex^v は最早~許容されない。 ◎ A number of user agents historically implemented special support for first-in-form text controls with the name isindex, and this specification previously defined related user agent requirements for it. However, some user agents subsequently dropped that special support, and the related requirements were removed from this specification. So, to avoid problematic reinterpretations in legacy user agents, the name isindex is no longer allowed.

`~nameF$a に対しては[ `isindex^v, 空~文字列 ]以外の どの値も許容される。 ◎ Other than isindex, any non-empty value for name is allowed.\

[ `value$a 属性を有さない `Hidden$st ~control ]の `name$a 属性~用の~keyword `_charset_@v は特別であり,指定された場合、 `value$a 属性に代わって[ ~controlを`所有-$している~formの`符号化法$form ]が,提出-時における~controlの値を自動的に与えるようになる。 ◎ The name _charset_ is special: if used as the name of a Hidden control with no value attribute, then during submission the value attribute is automatically given a value consisting of the submission character encoding.

`name@m
`name$a 内容~属性を`反映-$し~MUST。 ◎ The name IDL attribute must reflect the name content attribute.

注記: ~DOM~clobbering【 “痛める” 】は、共通的な保安~上の課題をもたらす。 `name$a 内容~属性に組込みの~form~propの名前を利用するのは、避けること。 ◎ DOM clobbering is a common cause of security issues. Avoid using the names of built-in form properties with the name content attribute.

次の例では、 `input$e 要素は組込みの `method$a ~propを上書きする: ◎ In this example, the input element overrides the built-in method property:

let %form = document.createElement("form");
let %input = document.createElement("input");
%form.appendChild(%input);

%form.method;           // => "get"
%input.name = "method"; /* 
~DOM~clobberingはここで生じる
◎
DOM clobbering occurs here
 */
%form.method === %input; // => true

`input^e の名前は,組込みの~form~propより優先されるので、 `form.method^c による~JS参照は、組込みの `method$a ~propの代わりに,名前 `method^l の `input$e 要素を指すことになる。 ◎ Since the input name takes precedence over built-in form properties, the JavaScript reference form.method will point to the input element named "method" instead of the built-in method property.

4.10.18.2. 要素~方向性の提出-法: `dirname^a 属性

~form~control要素の `dirname@a 属性は、要素の`方向性$の提出を可能化し,`~form提出$の際に この値を包含させる名前を与える。 この属性には、空~文字列を指定しては~MUST_NOT。 ◎ The dirname attribute on a form control element enables the submission of the directionality of the element, and gives the name of the control that contains this value during form submission. If such an attribute is specified, its value must not be the empty string.

~text~controlと提出-~buttonを包含する~formの例: ◎ In this example, a form contains a text control and a submission button:

`directionality-1^xCode

利用者がこの~formを提出したとき、~UAは,順に[ "comment", "comment.dir", "mode" ]と称される 3 個の欄を含める。 利用者が "Hello" と手入力していたなら、その提出~本体は,次の様になるであろう: ◎ When the user submits the form, the user agent includes three fields, one called "comment", one called "comment.dir", and one called "mode"; so if the user types "Hello", the submission body might be something like:

comment=Hello&comment.dir=ltr&mode=add

利用者が手動で書字~方向を右横書きに切り替えて, "مرحبا" と手入力していたなら、その提出~本体は,次の様になるであろう: ◎ If the user manually switches to a right-to-left writing direction and enters "مرحبا", the submission body might be something like:

comment=~rtlWord1&comment.dir=rtl&mode=add

4.10.18.3. 利用者~入力の長さ上限の設定-法: `maxlength^a 属性

`~form~control~maxlength属性@ は、`~dirty値~flag$により制御され、利用者が入力できる文字~数の上限を宣言する。 この “文字~数” は,`~JS文字列~長さ$で測定され、 `textarea$e 要素の事例においては,すべての改行文字は 1 個の文字に正規化される ( ~CRLF ではなく)。 ◎ A form control maxlength attribute, controlled by the dirty value flag, declares a limit on the number of characters a user can input. The "number of characters" is measured using JavaScript string length and, in the case of textarea elements, with all newlines normalized to a single character (as opposed to CRLF pairs).

要素の `~form~control~maxlength属性$に指定する値は `妥当な非負~整数$で~MUST。 要素の `値に許容される最大~長さ@ は、[[ 要素がこの属性を有する ]~AND[ その値を`非負~整数として構文解析-$した結果 ~NEQ ~error ]ならば 結果の数 / ~ELSE_ ε ]とする。 ◎ If an element has its form control maxlength attribute specified, the attribute's value must be a valid non-negative integer. If the attribute is specified and applying the rules for parsing non-negative integers to its value results in a number, then that number is the element's maximum allowed value length. If the attribute is omitted or parsing its value results in an error, then there is no maximum allowed value length.

拘束検証 ⇒ 要素が次をすべて満たしている間は、`長過ぎる難あり$になる:

  • その`~dirty値~flag$ ~EQ ~T
  • その`値$が最後に変更されたのは,利用者の編集による(~scriptによるものではなく)
  • その`~API値$の`~JS文字列~長さ$ ~GT その`値に許容される最大~長さ$ ~NEQ ε
◎ Constraint validation: If an element has a maximum allowed value length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change made by a script), and the JavaScript string length of the element's API value is greater than the element's maximum allowed value length, then the element is suffering from being too long.

~UAは、利用者が,要素の`~API値$を[ その`~JS文字列~長さ$ ~GT 要素の`値に許容される最大~長さ$ ]なる値に設定させないようにして~MAY。 ◎ User agents may prevent the user from causing the element's API value to be set to a value whose JavaScript string length is greater than the element's maximum allowed value length.

注記: `textarea$e 要素の事例では、`~API値$と`値$は相違する。 特に、`値に許容される最大~長さ$が検査される前に,それ用に`改行を正規化-$する(一方で `行折返し$は適用されない)。 ◎ In the case of textarea elements, the API value and value differ. In particular, the textarea line break normalization transformation is applied before the maximum allowed value length is checked (whereas the textarea wrapping transformation is not applied).

4.10.18.4. 利用者~入力の長さ下限の設定-法: `minlength^a 属性

`~form~control~minlength属性@ は、`~dirty値~flag$により制御され、利用者が入力できる文字~数の下限を宣言する。 この “文字~数” は,`~JS文字列~長さ$で測定され、 `textarea$e 要素の事例においては、すべての改行文字は 1 個の文字に正規化される(~CRLFでなく)。 ◎ A form control minlength attribute, controlled by the dirty value flag, declares a lower bound on the number of characters a user can input. The "number of characters" is measured using JavaScript string length and, in the case of textarea elements, with all newlines normalized to a single character (as opposed to CRLF pairs).

注記: `minlength$a 属性は `required^a 属性を含意しない。 当の~form~controlが `required^a 属性を有さない場合、値は依然として省略し得る — `minlength$a 属性が~~有効になるのは、利用者が何らかの値を手入力したときに限られる。 作者は、空~文字列を許容しない場合には, `required^a 属性も設定する必要がある。 ◎ The minlength attribute does not imply the required attribute. If the form control has no required attribute, then the value can still be omitted; the minlength attribute only kicks in once the user has entered a value at all. If the empty string is not allowed, then the required attribute also needs to be set.

要素の`~form~control~minlength属性$に指定する値は、`妥当な非負~整数$で~MUST。 要素の `値に許容される最小~長さ@ は、[[ 要素が この属性を有する ]~AND[ その値を`非負~整数として構文解析-$した結果 ~NEQ ~error ]ならば 結果の数 / ~ELSE_ ε ]とする。 ◎ If an element has its form control minlength attribute specified, the attribute's value must be a valid non-negative integer. If the attribute is specified and applying the rules for parsing non-negative integers to its value results in a number, then that number is the element's minimum allowed value length. If the attribute is omitted or parsing its value results in an error, then there is no minimum allowed value length.

要素の[ `値に許容される最大~長さ$, `値に許容される最小~長さ$ ]の両者とも ε でない場合、[ `値に許容される最小~長さ$ ~LTE `値に許容される最大~長さ$ ]で~MUST。 ◎ If an element has both a maximum allowed value length and a minimum allowed value length, the minimum allowed value length must be smaller than or equal to the maximum allowed value length.

拘束検証 ⇒ 要素が次をすべて満たしている間は、`短か過ぎる難あり$になる

  • その`~dirty値~flag$ ~EQ ~T
  • その`値$が最後に変更されたのは,利用者の編集による(~scriptによるものではなく)
  • その`値$ ~NEQ 空~文字列
  • その`~API値$の`~JS文字列~長さ$ ~LT その`値に許容される最小~長さ$ ~NEQ ε
◎ Constraint validation: If an element has a minimum allowed value length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change made by a script), its value is not the empty string, and the JavaScript string length of the element's API value is less than the element's minimum allowed value length, then the element is suffering from being too short.

次の例には 4 個の~text~controlがある。 最初のそれは必須であり、 5 文字 以上にする必要がある。 他の 3 個は任意選択であるが、利用者が埋める場合には, 10 文字~以上を手入力する必要がある。 ◎ In this example, there are four text controls. The first is required, and has to be at least 5 characters long. The other three are optional, but if the user fills one in, the user has to enter at least 10 characters.

`minimum-input-length-1^xCode

4.10.18.5. ~form~controlの可能化-法と不能化-法: `disabled^a 属性

`disabled@a 内容~属性は`真偽~属性$である。 ◎ The disabled content attribute is a boolean attribute.

注記: `option$e 要素~用の `disabled^a 属性, `optgroup$e 要素~用の `disabled^a 属性は、別々に定義される。 ◎ The disabled attribute for option elements and the disabled attribute for optgroup elements are defined separately.

~form~control %C は、次のいずれかを満たすならば `不能化され@ ているとされる: ◎ A form control is disabled if any of the following conditions are met:

  1. %C は次をすべて満たす

    • [ `button$e / `input$e / `select$e / `textarea$e ]要素である
    • `disabled$a 属性を有する(その値にかかわらず)
    ◎ The element is a button, input, select, or textarea element, and the disabled attribute is specified on this element (regardless of its value).
  2. 次をすべて満たす要素 %F がある

    • %F は `fieldset$e 要素である
    • %F は `~disabled0$a 属性を有する
    • %C ~IN { %F の子孫 }
    • [ %F の`~legend$ ~EQ ε ]~OR[ %C ~NIN { %F の`~legend$の子孫 } ]
    ◎ The element is a descendant of a fieldset element whose disabled attribute is specified, and is not a descendant of that fieldset element's first legend element child, if any.

~form~controlが`不能化され$ている間は、`利用者~対話~task源$から`~queueされ$る どの `click$et ~eventも,その要素に配送されないようにし~MUST。 ◎ A form control that is disabled must prevent any click events that are queued on the user interaction task source from being dispatched on the element.

拘束検証 ⇒ 要素は、`不能化され$ている間は,`拘束検証の対象外$になる ◎ Constraint validation: If an element is disabled, it is barred from constraint validation.

`disabled@m
`disabled$a 内容~属性を`反映-$し~MUST。 ◎ The disabled IDL attribute must reflect the disabled content attribute.

4.10.18.6. ~form提出

`~form提出用の属性@ は、 `form$e 要素にも,`提出-~button$†にも指定できる。 († ~formを提出する~buttonを表現する要素 — 例えば `input$e 要素のうち `type$a 属性が `Submit$st 状態にあるもの。) ◎ Attributes for form submission can be specified both on form elements and on submit buttons (elements that represent buttons that submit forms, e.g. an input element whose type attribute is in the Submit Button state).

`form$e 要素には、次に挙げる`~form提出用の属性$が指定されて~MAY ⇒ `action$a, `enctype$a, `method$a, `novalidate$a, `target$a ◎ The attributes for form submission that may be specified on form elements are action, enctype, method, novalidate, and target.

`提出-~button$には、次に挙げる,対応する`~form提出用の属性$が指定されて~MAY ⇒ `formaction$a, `formenctype$a, `formmethod$a, `formnovalidate$a, `formtarget$a — これらの属性の省略-時の既定は、 `form$e 要素に与えられた対応する属性の値になる。 ◎ The corresponding attributes for form submission that may be specified on submit buttons are formaction, formenctype, formmethod, formnovalidate, and formtarget. When omitted, they default to the values given on the corresponding attributes on the form element.


`action@a / `formaction@a 内容~属性に指定する値は、`前後~空白~可の妥当かつ空でない~URL$で~MUST。 ◎ The action and formaction content attributes, if specified, must have a value that is a valid non-empty URL potentially surrounded by spaces.

要素の `動作@ は、次に従って決定される値である:

  1. [ 要素は`提出-~button$である ]~AND[ 要素は `formaction$a 属性を有する ]ならば その値
  2. ~ELSE_ [ 要素の`~form所有者$ %O ~NEQ ~NULL ]~AND[ %O は `action$a 属性を有する ]ならば その値
  3. ~ELSE_ 空~文字列
◎ The action of an element is the value of the element's formaction attribute, if the element is a submit button and has such an attribute, or the value of its form owner's action attribute, if it has one, or else the empty string.

`method@a / `formmethod@a 内容~属性は、`列挙ed属性$であり,次の~keywordと状態をとり得る: ◎ The method and formmethod content attributes are enumerated attributes with the following keywords and states:

  • ~keyword `get@v は、 `GET@st 状態に対応付けられる — それは、~HTTP~GET~methodを指示する。 ◎ The keyword get, mapping to the state GET, indicating the HTTP GET method.
  • ~keyword `post@v は、 `POST@st 状態に対応付けられる — それは、~HTTP~POST~methodを指示する。 ◎ The keyword post, mapping to the state POST, indicating the HTTP POST method.
  • ~keyword `dialog@v は、 `dialog@st 状態に対応付けられる — それは、次が意図されることを指示する ⇒ `form$e の提出-時に,その~formが見出される `dialog$e ~boxが[ 在るならば それを閉じる / 無いならば 提出しない ] ◎ The keyword dialog, mapping to the state dialog, indicating that submitting the form is intended to close the dialog box in which the form finds itself, if any, and otherwise not submit.

これらの属性に対する`妥当でない値~用の既定$は、 `GET$st 状態とする。 `method$a 属性に対する`値なし用の既定$も `GET$st 状態とする。 ( `formmethod$a 属性には,[ `値なし用の既定$ / `妥当でない値~用の既定$ ]は無い。) ◎ The invalid value default for these attributes is the GET state. The missing value default for the method attribute is also the GET state. (There is no missing value default or invalid value default for the formmethod attribute.)

要素の `~method@ は、上に与えた いずれかの状態をとる — それは、[ 要素は`提出-~button$である ]~AND[ 要素は `formmethod$a 属性を有する ]ならば その属性の状態 / ~ELSE_ 要素の`~form所有者$の `method$a 属性の状態 ]とする。 ◎ The method of an element is one of those states. If the element is a submit button and has a formmethod attribute, then the element's method is that attribute's state; otherwise, it is the form owner's method attribute's state.

`method$a 属性を利用して 既定の値 `get$v を明示的に指定する例 — 探索~queryは、~URL内に提出されるようになる: ◎ Here the method attribute is used to explicitly specify the default value, "get", so that the search query is submitted in the URL:

`method-get-1^xCode

他方, `method$a 属性に値 `post$v に指定した場合、利用者の~messageは,~HTTP要請の本体~内に提出される: ◎ On the other hand, here the method attribute is used to specify the value "post", so that the user's message is submitted in the HTTP request's body:

`method-post-1^xCode

次の例では、 `form$e は `dialog$e に利用される。 ~formが提出されたとき~dialogを自動的に閉じるため、 `method$a 属性には `dialog$v ~keywordが利用されている。 ◎ In this example, a form is used with a dialog. The method attribute's "dialog" keyword is used to have the dialog automatically close when the form is submitted.

`method-dialog-1^xCode
<script>
 var %ship = document.getElementById('ship');
 %ship.showModal();
 %ship.onclose = function (%event) {
   if (%ship.returnValue == 'board') {
     // ...
   } else {
     // ...
   }
 };
</script>

`enctype@a / `formenctype@a 内容~属性は、`列挙ed属性$であり,次の~keywordと状態をとり得る: ◎ The enctype and formenctype content attributes are enumerated attributes with the following keywords and states:

  • "`~form_urlencoded@sT" ~keywordと, 対応する状態。 ◎ The "application/x-www-form-urlencoded" keyword and corresponding state.
  • "`~mp_form_data@sT" ~keywordと, 対応する状態。 ◎ The "multipart/form-data" keyword and corresponding state.
  • "`~text_plain@sT" ~keywordと, 対応する状態。 ◎ The "text/plain" keyword and corresponding state.

[ これらの属性に対する `妥当でない値~用の既定$ / `enctype$a 属性に対する`値なし用の既定$ ]は、 `~form_urlencoded$sT 状態とする。 ( `formenctype$a 属性には,`値なし用の既定$は無い。) ◎ The invalid value default for these attributes is the application/x-www-form-urlencoded state. The missing value default for the enctype attribute is also the application/x-www-form-urlencoded state. (There is no missing value default for the formenctype attribute.)

要素の `~enctype@ は、これら 3 状態のいずれかをとり,[ 要素は[ `提出-~button$である ]~AND[ `formenctype$a 属性を有する ]ならばその属性の状態 / ~ELSE_ 要素の`~form所有者$の`enctype$a 属性の状態 ]になるとする。 ◎ The enctype of an element is one of those three states. If the element is a submit button and has a formenctype attribute, then the element's enctype is that attribute's state; otherwise, it is the form owner's enctype attribute's state.


`target@a / `formtarget@a 内容~属性に指定する値は、`妥当な閲覧文脈~名または~keyword$で~MUST。 ◎ The target and formtarget content attributes, if specified, must have values that are valid browsing context names or keywords.


`novalidate@a / `formnovalidate@a 内容~属性は`真偽~属性$である。 在する場合、 ~form/要素 は,提出の間に検証されないことを指示する。 ◎ The novalidate and formnovalidate content attributes are boolean attributes. If present, they indicate that the form is not to be validated during submission.

要素の `検証なし状態@ は、[ 要素が次を満たすならば ~T / ~ELSE_ ~F ]とする ⇒ [[ `提出-~button$である ]~AND[ `formnovalidate$a 属性を有する ]]~OR[ `~form所有者$は[ ~NULL でない, かつ `novalidate$a 属性を有する ]] ◎ The no-validate state of an element is true if the element is a submit button and the element's formnovalidate attribute is present, or if the element's form owner's novalidate attribute is present, and false otherwise.

この属性は、検証~拘束を備える~formに “保存-” ~buttonを含ませて,[ 利用者が,~form内の~dataを全部的に手入力していない場合でも、それらの進捗を保存できる ]ようにするときに有用になる。 次の単純な~form例には、 2 個の必須の欄に加えて, 3 個の~button — ~form提出-用の~button(両~欄とも埋めることが要求される), 保存-用の~button(利用者が後で戻って来て埋められるようにする), ~formを まるごと取消す~button — がある: ◎ This attribute is useful to include "save" buttons on forms that have validation constraints, to allow users to save their progress even though they haven't fully entered the data in the form. The following example shows a simple form that has two required fields. There are three buttons: one to submit the form, which requires both fields to be filled in; one to save the form so that the user can come back and fill it in later; and one to cancel the form altogether.

`method-post-2^xCode

`action@m
`action$a 内容~属性を`反映-$し~MUST。 ただし、取得子は,[ 此れは その内容~属性を有さない ]~OR[ 此れは その内容~属性を有していて,その値 ~EQ 空~文字列 ]ならば、此れの`~node文書$の`~URL$docを返さ~MUST。
`target@m
`target$a 内容~属性を`反映-$し~MUST。
`method@m
`enctype@m
`encoding@m
順に,`既知の値のみに制限され$る下で[ `method$a, `enctype$a, `enctype$a ]内容~属性を`反映-$し~MUST。
`noValidate@m
`novalidate$a 内容~属性を`反映-$し~MUST。
`formAction@m
`formaction$a 内容~属性を`反映-$し~MUST。 ただし、取得子は,[ 此れは その内容~属性を有さない ]~OR[ 此れは その内容~属性を有していて,その値 ~EQ 空~文字列 ]ならば、此れの`~node文書$の`~URL$docを返さ~MUST。
`formEnctype@m
`formMethod@m
順に,`既知の値のみに制限され$る下で[ `formenctype$a, `formmethod$a ]内容~属性を`反映-$し~MUST。
`formNoValidate@m
`formTarget@m
順に,[ `formnovalidate$a, `formtarget$a ]内容~属性を`反映-$し~MUST。
◎ The action IDL attribute must reflect the content attribute of the same name, except that on getting, when the content attribute is missing or its value is the empty string, the element's node document's URL must be returned instead. The target IDL attribute must reflect the content attribute of the same name. The method and enctype IDL attributes must reflect the respective content attributes of the same name, limited to only known values. The encoding IDL attribute must reflect the enctype content attribute, limited to only known values. The noValidate IDL attribute must reflect the novalidate content attribute. The formAction IDL attribute must reflect the formaction content attribute, except that on getting, when the content attribute is missing or its value is the empty string, the element's node document's URL must be returned instead. The formEnctype IDL attribute must reflect the formenctype content attribute, limited to only known values. The formMethod IDL attribute must reflect the formmethod content attribute, limited to only known values. The formNoValidate IDL attribute must reflect the formnovalidate content attribute. The formTarget IDL attribute must reflect the formtarget content attribute.
4.10.18.6.1. ~form~controlの自動focus法: `autofocus^a 属性

`autofocus@a 内容~属性により、作者は,[ 頁が読込まれ次第 / 当の~formが見出される `dialog$e が示され次第 ],~controlを~focusさせるよう指示できるようになる — 利用者は、当の~controlに 手動で~focusせずに,打込みを開始できるようになる。 ◎ The autofocus content attribute allows the author to indicate that a control is to be focused as soon as the page is loaded or as soon as the dialog within which it finds itself is shown, allowing the user to just start typing without having to manually focus the main control.

`autofocus$a 属性は`真偽~属性$である。 ◎ The autofocus attribute is a boolean attribute.

要素 %要素 が属する `自動focus根@† は、 %要素 の`広義~先祖$に `dialog$e 要素が[ 在るならば それらのうち %要素 に最も近いもの / 無いならば %要素 の last `広義~先祖$である要素†† ]とする。 ◎ An element's nearest ancestor autofocus scoping root element is the element itself if the element is a dialog element, or else is the element's nearest ancestor dialog element, if any, or else is the element's last inclusive ancestor element.

【† 原文では, “nearest ancestor autofocus scoping root element” といういかにも長い呼称なので、この訳では略記する。 】【†† “last” が意図不明。 “`木~順序$で最後” を意味するならば、定義により,最後の`広義~先祖$は %要素 自身になる。 】

同じ`自動focus根$に属する複数の要素が, `autofocus$a 属性を有していては~MUST_NOT。 ◎ There must not be two elements with the same nearest ancestor autofocus scoping root element that both have the autofocus attribute specified.

`autofocus$a 属性を有する要素 %要素 が,文書の`中へ挿入された$ときは、`利用者~対話~task源$から,次を走らす`~taskを~queueする$: ◎ When an element with the autofocus attribute specified is inserted into a document, queue a task on the user interaction task source to run the following steps:

  1. ~IF[ 利用者は~focusを変更しないよう望むことを指示した(例えば,~form~control内で打込みを開始することにより) ] ⇒ ~UAの任意選択で ⇒ ~RET ◎ If the user has indicated (for example, by starting to type in a form control) that they do not wish focus to be changed, then optionally return.
  2. %文書 ~LET %要素 の`~node文書$ ◎ Let target be the element's node document.
  3. %B ~LET %文書 が`属する閲覧文脈$ ◎ ↓
  4. ~IF[ %B ~EQ ε ] ⇒ ~RET ◎ If target has no browsing context, then return.
  5. %T ~LET %B の`~top-level閲覧文脈$ ◎ ↓
  6. ~IF[ %T ~EQ ε (例: %B は`入子の閲覧文脈$であって, %B の`親~閲覧文脈$ ~EQ ε のとき) ] ⇒ ~RET ◎ If target's browsing context has no top-level browsing context (e.g., it is a nested browsing context with no parent browsing context), then return.
  7. ~IF[ 次のいずれかが満たされる ] ⇒ ~RET:

    • `閲覧文脈~sandbox化( 自動~特色機能 )~flag$ ~IN %文書 の`作動中の~sandbox法~flag集合$ ◎ If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.
    • ( %文書 の`生成元$, %T 内の現在~focusされている要素の`~node文書$の`生成元$ ) は`同一生成元$でない ◎ If target's origin is not the same as the origin of the node document of the currently focused element in target's top-level browsing context, then return.
    • ( %文書 の`生成元$, %T にて`作動中の文書$の`生成元$ ) は`同一生成元$でない ◎ If target's origin is not the same as the origin of the active document of target's top-level browsing context, then return.
    • ある`文書$ %D があって,次がいずれも満たされる:

      • ~UAは、ある要素が %D の`中へ挿入された$ことに呼応して,この手続きの最後の段にすでに到達した【?】
      • %D の`~top-level閲覧文脈$にて`作動中の文書$ ~EQ %T にて`作動中の文書$
      ◎ If the user agent has already reached the last step of this list of steps in response to an element being inserted into a Document whose top-level browsing context's active document is the same as target's top-level browsing context's active document, then return.
  8. `~objを~focusする$( %要素 ) — 加えて,~UAは、次をしても~MAY ⇒ 文書の~scrolling位置も変更するか,あるいは 要素を利用者に注目させるような何らかの他の動作を遂行する ◎ Run the focusing steps for the element. User agents may also change the scrolling position of the document, or perform some other action that brings the element to the user's attention.

注記: これは、文書を読込んでいる間の自動的~focusを取扱う。 `dialog$e 要素の[ `show()$m / `showModal()$m ]~methodも, `autofocus$a 属性を処理する。 ◎ This handles the automatic focusing during document load. The show() and showModal() methods of dialog elements also processes the autofocus attribute.

注記: ~controlを~focusするとき、~UAは,~focusを失った~browser~windowを~focusする必要はない。 ◎ Focusing the control does not imply that the user agent has to focus the browser window if it has lost focus.

`autofocus@m
`autofocus$a 内容~属性を`反映-$し~MUST。 ◎ The autofocus IDL attribute must reflect the content attribute of the same name.

次の~code片の~text~controlは、文書が読込まれたときに~focusされることになる。 ◎ In the following snippet, the text control would be focused when the document was loaded.

`autofocus-1^xCode

4.10.18.7. 自動充填( autofill )

【 この節の内容は、 別ページにて 。 】

4.10.19. ~text~control選択~用の~API

[ `input$e / `textarea$e ]要素は、それらの選択を取扱うためとして,いくつかの~memberを定義している。 それらは、ここに定義される~algoを共有する。 ◎ The input and textarea elements define several attributes and methods for handling their selection. Their shared algorithms are defined here.

この節における `~offset@ とは、~text内の,論理~順序による[ 始端, 終端, 隣接する ある 2 文字の間 ]のいずれかを指す,負でない整数であり、`~offset$ 0 は始端を指し,`~offset$[ ~text内の文字~数 ]は終端を指すとする。

【 この`~offset$の定義は、簡潔に記すために,この訳に導入している(原文の “offset” は、文字列~内の “文字の~offset” を表していて,記述がまわりくどいので)。 】【 文字の個数が[ 符号単位/符号位置 ]のどちらに基づくのか述べられていないが、少なくとも一部の~UAの実装は — `~form~control~maxlength属性$などと同様に — 符号単位(`~JS文字列~長さ$)に基づいている。 】

%element . `select()$m
~text~control内のすべてを選択する。 ◎ Selects everything in the text control.
%element . `selectionStart$m [ = %value ]
選択の始端を指す`~offset$を返す。 ◎ Returns the offset to the start of the selection.
設定して,選択の始端を変更できる。 ◎ Can be set, to change the start of the selection.
%element . `selectionEnd$m [ = %value ]
選択の終端を指す`~offset$を返す。 ◎ Returns the offset to the end of the selection.
設定して,選択の終端を変更できる。 ◎ Can be set, to change the end of the selection.
%element . `selectionDirection$m [ = %value ]
現在の`選択~方向$を返す。 ◎ Returns the current direction of the selection.
設定して,現在の`選択~方向$を変更できる。 ◎ Can be set, to change the direction of the selection.
可能な値は[ `forward^l, `backward^l, `none^l ]のいずれかである。 ◎ The possible values are "forward", "backward", and "none".
%element . `setSelectionRange(start, end [, direction] )$m
選択の[ 始端, 終端, 方向 ]を[ %start, %end, %direction ]に変更する。 %direction が省略された場合、方向は~platformの既定のそれ( `forward^l または `none^l )に再設定される。 ◎ Changes the selection to cover the given substring in the given direction. If the direction is omitted, it will be reset to be the platform default (none or forward).
%element . `setRangeText(replacement [, start, end [, selectionMode ] ] )$m
~textのある範囲を,新たな~textに置換する。 %start, %end 引数が供されない場合の範囲は、選択~全体と見做される。 ◎ Replaces a range of text with the new text. If the start and end arguments are not provided, the range is assumed to be the selection.

~~最後の引数は、~textが置換された後に,選択が どう設定されることになるかを決定する。 可能な値は: ◎ The final argument determines how the selection will be set after the text has been replaced. The possible values are:

`select$l
新たに挿入された~textを選択する。 ◎ Selects the newly inserted text.
`start$l
選択の始端, 終端ともに 挿入された~textの直前に移動する。 ◎ Moves the selection to just before the inserted text.
`end$l
選択の始端, 終端ともに 挿入された~textの直後に移動する。 ◎ Moves the selection to just after the selected text.
`preserve$l
選択をなるべく保全しようと試みる。 これが既定。 ◎ Attempts to preserve the selection. This is the default.

[ これらの~APIが`適用される$すべての `input$e 要素, および `textarea$e 要素 ]は、どの時点でも(要素が`具現化されて$いなくとも),[ `選択@, `~text手入力~cursor位置@ ]のどちらかは有するとする。 初期~状態では、~controlの始端を指す~text手入力~cursor位置を有するものとされ~MUST。 ◎ All input elements to which these APIs apply, and all textarea elements, have either a selection or a text entry cursor position at all times (even for elements that are not being rendered). The initial state must consist of a text entry cursor at the beginning of the control.

【 ~text手入力~cursor位置は,実質的には “始端と終端が一致する空の選択” と同じに見受けられる( “空の選択” と “選択なし” を区別するための用語かもしれないが、そのような区別が有意になる箇所は見当たらない)。 】

これらの~APIは、[ `input$e 要素に対しては その`値$ / `textarea$e 要素に対しては その`~API値$ ]に対し演算し~MUST。 この,演算される値~文字列は、以下に与える~algoにおいては,当の要素に `関連する値@ と総称される。 ◎ For input elements, these APIs must operate on the element's value. For textarea elements, these APIs must operate on the element's API value. In the below algorithms, we call the value string being operated on the relevant value.

`textarea$e 要素~用に`生の値$tAに代えて`~API値$を利用することは、文字 `000D^U `CR^smb が正規化されて消えることを意味する。 例えば: ◎ The use of API value instead of raw value for textarea elements means that U+000D (CR) characters are normalized away. For example,

<textarea id="demo"></textarea>
<script>
 %demo.value = "A\r\nB";
 %demo.setRangeText("replaced", 0, 2);
 assert(%demo.value === "replacedB");
</script>

`生の値$tA `A\r\nB^l に演算した場合、文字~並び `A\r^l が置換される結果 `replaced\nB^l になるが、`~API値$ `A\nB^l を利用するので,文字~並び `A\n^l が置換される結果 `replacedB^l になる。 ◎ If we had operated on the raw value of "A\r\nB", then we would have replaced the characters "A\r", ending up with a result of "replaced\nB". But since we used the API value of "A\nB", we replaced the characters "A\n", giving "replacedB".

これらの~APIが適用される要素に対し,`関連する値$が変化したときは、次を走らすとする: ◎ Whenever the relevant value changes for an element to which these APIs apply, run these steps:

  1. ~IF[ 要素は`選択$を有する ]: ◎ If the element has a selection:

    1. ~IF[ 選択の始端は `関連する値$の終端を過ぎている ] ⇒ 選択の始端 ~SET `関連する値$の終端 ◎ If the start of the selection is now past the end of the relevant value, set it to the end of the relevant value.
    2. ~IF[ 選択の終端は `関連する値$の終端を過ぎている ] ⇒ 選択の終端 ~SET `関連する値$の終端 ◎ If the end of the selection is now past the end of the relevant value, set it to the end of the relevant value.
    3. ~IF[ ~UAは空の選択を~supportしない ]~AND[ 選択の始端, 終端とも`関連する値$の終端を指している ] ⇒ 選択を除去した上で,要素の`~text手入力~cursor位置$ ~SET `関連する値$の終端 ◎ If the user agent does not support empty selection, and both the start and end of the selection are now pointing to the end of the relevant value, then instead set the element's text entry cursor position to the end of the relevant value, removing any selection.
  2. ~ELSE( 要素は`~text手入力~cursor位置$を有する) ⇒ ~IF[ `~text手入力~cursor位置$は `関連する値$の終端を過ぎている ] ⇒ `~text手入力~cursor位置$ ~SET `関連する値$の終端 ◎ Otherwise, the element must have a text entry cursor position position. If it is now past the end of the relevant value, set it to the end of the relevant value.

注記: 上で切詰める手続きのみならず,この仕様の他所にも、`関連する値$が変化するときに,`~text手入力~cursor位置$を改変する事例がある。 例えば `textarea$e 用の `value$m 設定子など。 ◎ In some cases where the relevant value changes, other parts of the specification will also modify the text entry cursor position, beyond just the clamping steps above. For example, see the value setter for textarea.

文字 `200D^U ZERO WIDTH JOINER などの可視でない文字であっても,文字として数えられる。 したがって,具体例として、選択は 可視でない文字のみを含むこともあり,~text挿入~cursorは そのような文字の前後いずれかの側に配置され得る。 ◎ Characters with no visible rendering, such as U+200D ZERO WIDTH JOINER, still count as characters. Thus, for instance, the selection can include just an invisible character, and the text insertion cursor can be placed to one side or another of such a character.

[ `input$e / `textarea$e ]要素において~text`選択$を変更するような~UI特色機能は、可能な所では,`選択~範囲を設定する$~algoを利用して実装され~MUST — 例えば すべてに同じ~eventが発火されるように。 ◎ Where possible, user interface features for changing the text selection in input and textarea elements must be implemented using the set the selection range algorithm so that, e.g., all the same events fire.

各[ `input$e / `textarea$e ]要素の`選択$は、次のいずれかを値にとる `選択~方向@ を持つ ⇒# `forward^l, `backward^l, `none^l ◎ The selections of input and textarea elements have a selection direction, which is either "forward", "backward", or "none".\

この方向は、利用者が選択を操作するときに設定される。 選択~方向の正確な意味は~platformに依存する。 ◎ This direction is set when the user manipulates the selection. The exact meaning of the selection direction depends on the platform.\

要素の `選択~方向を設定する@ ときは、所与の ( %方向 ) に対し,次を走らす ⇒ 要素の`選択~方向$ ~SET [ 次が満たされるならば `forward^l / ~ELSE_ %方向 ] ⇒ [ %方向 ~EQ `none^l ]~AND[ ~platformは %方向 を~supportしない ] ◎ To set the selection direction of an element to a given direction, update the element's selection direction to the given direction, unless the direction is "none" and the platform does not support that direction; in that case, update the element's selection direction to "forward".

注記: Windows 上では、この選択~方向は、選択に相対的な~caret位置を指示する: ~caretは、方向に応じて[ `forward^l ならば選択の終端 / `backward^l ならば選択の始端 ]にある。 Windows に `none^l 方向はない。 ◎ On Windows, the direction indicates the position of the caret relative to the selection: a "forward" selection has the caret at the end of the selection and a "backward" selection has the caret at the start of the selection. Windows has no "none" direction.

Mac では、方向は,利用者が Shift + 矢印~keyを用いて,選択~範囲を調整するときに 選択のどちらの端が影響されるかを指示する: 改変される端は、方向に応じて[ `forward^l ならば選択の終端 / `backward^l ならば選択の始端 ]になる。 Mac では、 `none^l 方向が既定であり,特定0の方向はまだ選択されてないことを指示する。 方向は、利用者が選択を最初に調整するときに,どっちの矢印~keyが利用されたかに基づいて暗黙的に設定される。 ◎ On Mac, the direction indicates which end of the selection is affected when the user adjusts the size of the selection using the arrow keys with the Shift modifier: the "forward" direction means the end of the selection is modified, and the "backward" direction means the start of the selection is modified. The "none" direction is the default on Mac, it indicates that no particular direction has yet been selected. The user sets the direction implicitly when first adjusting the selection, based on which directional arrow key was used.

`select()@m

被呼出時には、次の手続きを走らせ~MUST: ◎ The select() method, when invoked, must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[[ この~methodは此れに`適用されない$ ]~OR[ 此れに対応する~controlには選択-可能な~textはない ]] ⇒ ~RET ◎ If this element is an input element, and either select() does not apply to this element or the corresponding control has no selectable text, return.

    具体例として、 `<input type=color>^e を,[ 16 進~色~codeを受容する~text~control ]ではなく[ 色~pickerを擁する~color-well ]として具現化する~UAにおいては、選択-可能な~textは無いので,この~methodの~callは無視される。 ◎ For instance, in a user agent where <input type=color> is rendered as a color well with a picker, as opposed to a text control accepting a hexadecimal color code, there would be no selectable text, and thus calls to the method are ignored.

  2. `選択~範囲を設定する$( 0, `無限大^i ) ◎ Set the selection range with 0 and infinity.
`selectionStart@m

取得子は、次の手続きを走らせ~MUST: ◎ The selectionStart attribute's getter must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~RET ~NULL ◎ If this element is an input element, and selectionStart does not apply to this element, return null.
  2. ~IF[ 此れは`選択$を有さない ] ⇒ ~RET 此れに`関連する値$の中で`~text手入力~cursor位置$を指す`~offset$ ◎ If there is no selection, return the offset (in logical order) within the relevant value to the character that immediately follows the text entry cursor.
  3. ~RET 此れに`関連する値$の中で`選択$の始端を指す`~offset$ ◎ Return the offset (in logical order) within the relevant value to the character that immediately follows the start of the selection.

設定子は、次の手続きを走らせ~MUST: ◎ The selectionStart attribute's setter must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~THROW `InvalidStateError$E ◎ If this element is an input element, and selectionStart does not apply to this element, throw an "InvalidStateError" DOMException.
  2. %終端 ~LET { 此れの `selectionEnd$m 属性の値, 所与の値 } の最大 ◎ Let end be the value of this element's selectionEnd attribute. ◎ If end is less than the given value, set end to the given value.
  3. `選択~範囲を設定する$( 所与の値, %終端, 此れの `selectionDirection$m 属性の値 ) ◎ Set the selection range with the given value, end, and the value of this element's selectionDirection attribute.
`selectionEnd@m

取得子は、次の手続きを走らせ~MUST: ◎ The selectionEnd attribute's getter must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~RET ~NULL ◎ If this element is an input element, and selectionEnd does not apply to this element, return null.
  2. ~IF[ 此れは`選択$を有さない ] ⇒ ~RET 此れに`関連する値$の中で`~text手入力~cursor位置$を指す`~offset$ ◎ If there is no selection, return the offset (in logical order) within the relevant value to the character that immediately follows the text entry cursor.
  3. ~RET 此れに`関連する値$の中で`選択$の終端を指す`~offset$ ◎ Return the offset (in logical order) within the relevant value to the character that immediately follows the end of the selection.

設定子は、次の手続きを走らせ~MUST: ◎ The selectionEnd attribute's setter must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~THROW `InvalidStateError$E ◎ If this element is an input element, and selectionEnd does not apply to this element, throw an "InvalidStateError" DOMException.
  2. `選択~範囲を設定する$( 此れの `selectionStart$m 属性の値, 所与の値, 此れの `selectionDirection$m 属性の値 ) ◎ Set the selection range with the value of this element's selectionStart attribute, the given value, and the value of this element's selectionDirection attribute.
`selectionDirection@m

取得子は、次の手続きを走らせ~MUST: ◎ The selectionDirection attribute's getter must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~RET ~NULL ◎ If this element is an input element, and selectionDirection does not apply to this element, return null.
  2. ~RET 此れの`選択~方向$ ◎ Return this element's selection direction.

設定子は、次の手続きを走らせ~MUST: ◎ The selectionDirection attribute's setter must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~THROW `InvalidStateError$E ◎ If this element is an input element, and selectionDirection does not apply to this element, throw an "InvalidStateError" DOMException.
  2. `選択~範囲を設定する$( 此れの `selectionStart$m 属性の値, 此れの `selectionEnd$m 属性の値, 所与の値 ) ◎ Set the selection range with the value of this element's selectionStart attribute, the value of this element's selectionEnd attribute, and the given value.
`setSelectionRange(start, end, direction)@m

被呼出時には、次の手続きを走らせ~MUST: ◎ The setSelectionRange(start, end, direction) method, when invoked, must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~THROW `InvalidStateError$E ◎ If this element is an input element, and setSelectionRange() does not apply to this element, throw an "InvalidStateError" DOMException.
  2. `選択~範囲を設定する$( %start, %end, %direction ) ◎ Set the selection range with start, end, and direction.

~text~control【を表現する要素】 %要素 の `選択~範囲を設定する@ ときは、所与の ⇒# %始端 (非負~整数, ~NULL のいずれか), %終端 (非負~整数, ~NULL, `無限大^i のいずれか), %方向 (文字列, 省略時は ε) ◎終 に対し,次の手続き走らす — 以下においては、値 `無限大^i は他のどの値よりも大きいとする: ◎ To set the selection range with an integer or null start, an integer or null or the special value infinity end, and optionally a string direction, run the following steps:

  1. ~IF[ %始端 ~EQ ~NULL ] ⇒ %始端 ~SET 0 ◎ If start is null, let start be zero.
  2. ~IF[ %終端 ~EQ ~NULL ] ⇒ %終端 ~LET 0 ◎ If end is null, let end be zero.
  3. %L ~LET %要素 に`関連する値$の長さ ◎ ↓
  4. %終端 ~LET { %終端, %L } の最小 ◎ ↓
  5. %始端 ~LET { %始端, %L, %終端 } の最小 ◎ ↓
  6. %要素 に`関連する値$の中で,`選択$の範囲を[ %始端 `~offset$ 〜 %終端 `~offset$ ]に設定する — 範囲が空になる場合、空~選択の概念がない~UAにおいては,~cursorを %終端 `~offset$に設定する ◎ Set the selection of the text control to the sequence of characters within the relevant value starting with the character at the startth position (in logical order) and ending with the character at the (end-1)th position. Arguments greater than the length of the relevant value of the text control (including the special value infinity) must be treated as pointing at the end of the text control. If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end. In UAs where there is no concept of an empty selection, this must set the cursor to be just before the character with offset end.
  7. ~IF[ %方向 ~NIN { ε, `backward^l, `forward^l } ] ⇒ %方向 ~SET `none^l ◎ If direction is not a case-sensitive match for either the string "backward" or "forward", or if the direction argument was omitted, set direction to "none".
  8. %要素 の`選択~方向を設定する$( %方向 ) ◎ Set the selection direction of the text control to direction.
  9. ~IF[ 前~段までにより,~text~controlの`選択$は改変された(その範囲, `選択~方向$いずれにせよ) ] ⇒ ~task源に`利用者~対話~task源$を用いる下で,次を走らす`~taskを~queueする$ ⇒ %要素 に向けて,名前 `select$et の`~eventを発火する$ — 次のように初期化して ⇒ `bubbles$m 属性 ~SET ~T ◎ If the previous steps caused the selection of the text control to be modified (in either extent or direction), then queue a task, using the user interaction task source, to fire an event named select at the element, with the bubbles attribute initialized to true.

`setRangeText(replacement, start, end, selectionMode)@m の被呼出時には、次の手続きを走らせ~MUST: ◎ The setRangeText(replacement, start, end, selectMode) method, when invoked, must run the following steps:

  1. ~IF[ 此れは `input$e 要素である ]~AND[ この~methodは此れに`適用されない$ ] ⇒ ~THROW `InvalidStateError$E ◎ If this element is an input element, and setRangeText() does not apply to this element, throw an "InvalidStateError" DOMException.
  2. 此れの`~dirty値~flag$ ~SET ~T ◎ Set this element's dirty value flag to true.
  3. ( %選択~始端, %選択~終端 ) ~LET 此れの ( `selectionStart$m, `selectionEnd$m ) 属性の現在の値 ◎ ↓↓
  4. ~IF[ %start 以降の引数は与えられていない ] ⇒# ( %start, %end ) ~SET ( %選択~始端, %選択~終端 ); %selectionMode ~SET `preserve$l ◎ If the method has only one argument, then let start and end have the values of the selectionStart attribute and the selectionEnd attribute respectively. ◎ Otherwise, let start, end have the values of the second and third arguments respectively. ◎ ↓↓
  5. ~IF[ %start ~GT %end ] ⇒ ~THROW `IndexSizeError$E ◎ If start is greater than end, then throw an "IndexSizeError" DOMException.
  6. %L ~LET 此れに`関連する値$の長さ ◎ ↓
  7. %始端 ~SET { %start, %L } の最小 ◎ If start is greater than the length of the relevant value of the text control, then set it to the length of the relevant value of the text control.
  8. %終端 ~SET { %end, %L } の最小 ◎ If end is greater than the length of the relevant value of the text control, then set it to the length of the relevant value of the text control. ◎ ↑↑Let selection start be the current value of the selectionStart attribute. ◎ ↑↑Let selection end be the current value of the selectionEnd attribute.
  9. ~IF[ %始端 ~LT %終端 ] ⇒ 此れに`関連する値$から範囲[ %始端 `~offset$ 〜 %終端 `~offset$ ]にある文字を削除する ◎ If start is less than end, delete the sequence of characters within the element's relevant value starting with the character at the startth position (in logical order) and ending with the character at the (end-1)th position.
  10. 此れに`関連する値$の %始端 `~offset$に %replacement の値を挿入する ◎ Insert the value of the first argument into the text of the relevant value of the text control, immediately before the startth character.
  11. %新~終端 ~LET %始端 + ( %replacement の長さ ) ◎ Let new length be the length of the value of the first argument. ◎ Let new end be the sum of start and new length.
  12. %selectionMode に応じて: ◎ Run the appropriate set of substeps from the following list:

    `select@l ◎ If the fourth argument's value is "select"
    ( %選択~始端, %選択~終端 ) ~SET ( %始端, %新~終端 ) ◎ Let selection start be start. ◎ Let selection end be new end.
    `start@l ◎ If the fourth argument's value is "start"
    ( %選択~始端, %選択~終端 ) ~SET ( %始端, %始端 ) ◎ Let selection start and selection end be start.
    `end@l ◎ If the fourth argument's value is "end"
    ( %選択~始端, %選択~終端 ) ~SET ( %新~終端, %新~終端 ) ◎ Let selection start and selection end be new end.
    `preserve@l (既定) ◎ If the fourth argument's value is "preserve" (the default) ◎ ↑↑If the method has only one argument
    1. %差分 ~LET ( %replacement の長さ ) − ( %終端 − %始端 ) ◎ Let old length be end minus start. ◎ Let delta be new length minus old length.
    2. ~IF[ %選択~始端 ~GT %終端 ] ⇒ %選択~始端 ~INCBY %差分 ( %差分 が負の場合,すなわち 新たな~textが置換された~textより短い場合、 %選択~始端 の値は減ることになる) ◎ If selection start is greater than end, then increment it by delta. (If delta is negative, i.e. the new text is shorter than the old text, then this will decrease the value of selection start.)
    3. ~ELIF[ %選択~始端 ~GT %始端 ] ⇒ %選択~始端 ~SET %始端 ( %選択~始端 が置換された~textの途中にあった場合,選択の始端は新たな~textの始端に留められる) ◎ Otherwise: if selection start is greater than start, then set it to start. (This snaps the start of the selection to the start of the new text if it was in the middle of the text that it replaced.)
    4. ~IF[ %選択~終端 ~GT %終端 ] ⇒ %選択~終端 ~INCBY %差分 ◎ If selection end is greater than end, then increment it by delta in the same way.
    5. ~ELIF[ %選択~終端 ~GT %始端 ] ⇒ %選択~終端 ~SET %新~終端 ( %選択~終端 が置換された~textの途中にあった場合,選択の始端は新たな~textの終端に留められる) ◎ Otherwise: if selection end is greater than start, then set it to new end. (This snaps the end of the selection to the end of the new text if it was in the middle of the text that it replaced.)
  13. `選択~範囲を設定する$( %選択~始端, %選択~終端 ) ◎ Set the selection range with selection start and selection end.

`setRangeText()$m ~methodは、次の列挙を利用する: ◎ The setRangeText() method uses the following enumeration:

enum `SelectionMode@I {
  `select$l,
  `start$l,
  `end$l,
  `preserve$l // 既定
};

現在~選択されている~textを得るには、次の~JSで足りる: ◎ To obtain the currently selected text, the following JavaScript suffices:

var %selectionText = %control.value.substring(%control.selectionStart, %control.selectionEnd);

( %control は[ `input$e / `textarea$e ]要素とする。) ◎ ...where control is the input or textarea element.

3 つの属性を保全して,~text選択は保守しながら、~text~controlの始端に~textを追加する例: ◎ To add some text at the start of a text control, while maintaining the text selection, the three attributes must be preserved:

var %oldStart = %control.selectionStart;
var %oldEnd = %control.selectionEnd;
var %oldDirection = %control.selectionDirection;
var %prefix = "http://";
%control.value = %prefix + %control.value;
%control.setSelectionRange(%oldStart + %prefix.length, %oldEnd + %prefix.length, %oldDirection);

( %control は[ `input$e / `textarea$e ]要素とする。) ◎ ...where control is the input or textarea element.

4.10.20. 拘束

4.10.20.1. 各種 定義

`提出-可能$な要素は、 `拘束検証の対象外@ にある間を除いて, `拘束検証の候補@ になる(例えば、 `object$e 要素は`拘束検証の対象外$になる。) ◎ A submittable element is a candidate for constraint validation except when a condition has barred the element from constraint validation. (For example, an element is barred from constraint validation if it is an object element.)

要素には、 `~custom妥当性~error~message@ も定義され得る — 初期~時には,空~文字列とする。 その値が空~文字列でないときは、要素は,`~custom~errorの難あり$になる。 `setCustomValidity()$m ~methodを用いて,それを設定できる。 ~UAは、当の~controlにおける問題を利用者に~alertするときには、`~custom妥当性~error~message$を利用するべきである。 ◎ An element can have a custom validity error message defined. Initially, an element must have its custom validity error message set to the empty string. When its value is not the empty string, the element is suffering from a custom error. It can be set using the setCustomValidity() method. The user agent should use the custom validity error message when alerting the user to the problem with the control.

要素は、様々な仕方で拘束できる/され得る。 以下に,拘束検証の目的において~controlを妥当でなくするような,~form~controlがとり得る `妥当性~状態@ を挙げる。 (下の定義は規範的でない — 各~状態が適用されるかどうかは、この仕様の他所にて より精確に定義される。) ◎ An element can be constrained in various ways. The following is the list of validity states that a form control can be in, making the control invalid for the purposes of constraint validation. (The definitions below are non-normative; other parts of this specification define more precisely when each state applies or does not.)

`欠落の難あり@ ◎ Suffering from being missing
~controlは、 `required^a 属性( `input$e の `~requiredI$a / `textarea$e の `~requiredT$a )を有するが、その`値$がないとき。 ただし、[ `select$e 要素 / `~radio~button群$に属する~control ]においては、それらの各 節に指定されるように,より複雑な規則になる。 ◎ When a control has no value but has a required attribute (input required, textarea required); or, more complicated rules for select elements and controls in radio button groups, as specified in their sections.
`型~不一致の難あり@ ◎ Suffering from a type mismatch
任意の利用者~入力を許容する~controlの`値$が正しい構文でないとき( `Email$st, `Url$st )。 ◎ When a control that allows arbitrary user input has a value that is not in the correct syntax (E-mail, URL).
`~pattern不一致の難あり@ ◎ Suffering from a pattern mismatch
~controlの`値$が `pattern$a 属性を満たさないとき。 ◎ When a control has a value that doesn't satisfy the pattern attribute.
`長過ぎる難あり@ ◎ Suffering from being too long
~controlの`値$が`~form~control~maxlength属性$( `input$e の `~maxlengthI$a / `textarea$e の `~maxlengthT$a )に比して長過ぎるとき。 ◎ When a control has a value that is too long for the form control maxlength attribute (input maxlength, textarea maxlength).
`短か過ぎる難あり@ ◎ Suffering from being too short
~controlの`値$が`~form~control~minlength属性$( `input$e の `~minlengthI$a / `textarea$e の `~minlengthT$a )に比して短か過ぎるとき。 ◎ When a control has a value that is too short for the form control minlength attribute (input minlength, textarea minlength).
`~underflowの難あり@ ◎ Suffering from an underflow
~controlの`値$は 空~文字列でない, かつ `min$a 属性に比して低~過ぎるとき。 ◎ When a control has a value that is not the empty string and is too low for the min attribute.
`~overflowの難あり@ ◎ Suffering from an overflow
~controlの`値$は 空~文字列でない, かつ `max$a 属性に比して高~過ぎるとき。 ◎ When a control has a value that is not the empty string and is too high for the max attribute.
`~step不一致の難あり@ ◎ Suffering from a step mismatch
~controlの`値$が `step$a 属性が与える規則に合わないとき。 ◎ When a control has a value that doesn't fit the rules given by the step attribute.
`不良~入力の難あり@ ◎ Suffering from bad input
~controlの入力は不完全であり、~UAは,[ その現在の状態において,利用者が~formを提出できる ]と~~判断していないとき。 ◎ When a control has incomplete input and the user agent does not think the user ought to be able to submit the form in its current state.
【 すなわち、上に挙げられた他のどの “難あり” にも該当しないが, “難あり” にされるべきとき。 】
`~custom~errorの難あり@ ◎ Suffering from a custom error
~controlの`~custom妥当性~error~message$が空~文字列でないとき。 (これは、要素の `setCustomValidity()$m ~methodにより設定される。) ◎ When a control's custom validity error message (as set by the element's setCustomValidity() method) is not the empty string.

注記: 要素は,`不能化され$ていても,依然として これらいずれかの状態に難ありになり得る。 したがって,これらの状態は、提出の間に~formを検証するときに,利用者に問題を指示しない場合でも,~DOMにおいて表現され得る。 【拘束検証~APIを通して?】 ◎ An element can still suffer from these states even when the element is disabled; thus these states can be represented in the DOM even if validating the form during submission wouldn't indicate a problem to the user.

要素は、上述した どの`妥当性~状態$の難ありでもないとき, `自身の拘束を満たす@ とされる。 ◎ An element satisfies its constraints if it is not suffering from any of the above validity states.

4.10.20.2. 拘束検証

~UAは、 `form$e 要素 %~form の `拘束を静的に検証-@ することが要求されたときは,次の手続きを走らせ~MUST — それは、[ `肯定的^i, `否定的^i ]のいずれかを返す:

  • `肯定的^i は %~form 内のすべての~controlは妥当であることを表し、 `否定的^i はその否定を表す。
  • `否定的^i を返す場合の結果には,[ 妥当でないかつ, それを担当する~scriptもない要素 ]の~listも伴われる(場合によっては空になる)
◎ When the user agent is required to statically validate the constraints of form element form, it must run the following steps, which return either a positive result (all the controls in the form are valid) or a negative result (there are invalid controls) along with a (possibly empty) list of elements that are invalid and for which no script has claimed responsibility:
  1. %~control~list ~LET %~form が`所有-$している要素のうち,`提出-可能$であるものからなる,`木~順序$による~list ◎ Let controls be a list of all the submittable elements whose form owner is form, in tree order.
  2. %非~妥当~control~list ~LET 空~list ◎ Let invalid controls be an initially empty list of elements.
  3. %~control~list 内の ~EACH ( %欄 ) に対し: ◎ For each element field in controls, in tree order:

    1. ~IF[ %欄 は`拘束検証の候補$でない ] ⇒ ~CONTINUE ◎ If field is not a candidate for constraint validation, then move on to the next element.
    2. ~IF[ %欄 は`自身の拘束を満たす$ ] ⇒ ~CONTINUE ◎ Otherwise, if field satisfies its constraints, then move on to the next element.
    3. %非~妥当~control~list に %欄 を追加する ◎ Otherwise, add field to invalid controls.
  4. ~IF[ %非~妥当~control~list は空である ] ⇒ ~RET `肯定的^i ◎ If invalid controls is empty, then return a positive result.
  5. %未取扱~非妥当~control~list ~LET 空~list ◎ Let unhandled invalid controls be an initially empty list of elements.
  6. %非~妥当~control~list 内の ~EACH ( %欄 ) に対し: ◎ For each element field in invalid controls, if any, in tree order:

    1. %notCanceled ~LET %欄 に向けて,名前 `invalid$et の`~eventを発火する$ — 次のように初期化して ⇒ `cancelable$m 属性 ~SET ~T ◎ Let notCanceled be the result of firing an event named invalid at field, with the cancelable attribute initialized to true.
    2. ~IF[ %notCanceled ~EQ ~T ] ⇒ %未取扱~非妥当~control~list に %欄 を追加する ◎ If notCanceled is true, then add field to unhandled invalid controls.
  7. ~RET `否定的^i + %未取扱~非妥当~control~list ◎ Return a negative result with the list of elements in the unhandled invalid controls list.

~UAは、 `form$e 要素 %~form を `拘束を対話的に検証-@ するときは、次の手続きを走らせ~MUST ◎ If a user agent is to interactively validate the constraints of form element form, then the user agent must run the following steps:

  1. ~IF[ %~form の`拘束を静的に検証-$した結果 ~EQ `肯定的^i ] ⇒ ~RET `肯定的^i ◎ Statically validate the constraints of form, and let unhandled invalid controls be the list of elements returned if the result was negative. ◎ If the result was positive, then return that result.
  2. 前段の検証-結果に伴われる %未取扱~非妥当~control~list 内の 1 個~以上の要素の拘束についての問題を,利用者に報告する — ~UAは次をしても~MAY: ◎ Report the problems with the constraints of at least one of the elements given in unhandled invalid controls to the user. User agents\

    • `~objを~focusする$( ~list内のいずれかの要素 ) ◎ may focus one of those elements in the process, by running the focusing steps for that element, and\
    • 文書の~scrolling位置も変更する / 要素を利用者に注目させるような何らかの他の動作を遂行する。 ◎ may change the scrolling position of the document, or perform some other action that brings the element to the user's attention.\
    • 複数の拘束~違反を報告する。 ◎ User agents may report more than one constraint violation.\
    • 適切になるなら,関係する拘束~違反~報告を~~結合する (例: `~radio~button群$内の複数の~radio~buttonが必須とされている場合、報告する必要がある~errorは一つだけになる)。 ◎ User agents may coalesce related constraint violation reports if appropriate (e.g. if multiple radio buttons in a group are marked as required, only one error need be reported).\
    • いずれかの~controlが`具現化されて$いない場合(例: `hidden$a 属性を有するなど)、~script~errorを報告する。 ◎ If one of the controls is not being rendered (e.g. it has the hidden attribute set) then user agents may report a script error.
  3. ~RET `否定的^i ◎ Return a negative result.

4.10.20.3. 拘束検証~API

%element . `willValidate$m
[ %element は~formの提出-時に検証されるならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element will be validated when the form is submitted; false otherwise.
%element . `setCustomValidity(message)$m
~custom~errorを設定して %element が検証-時に失敗するようにする。 %message は 利用者に問題を報告するときに示される~messageを与える。 ◎ Sets a custom error, so that the element would fail to validate. The given message is the message to be shown to the user when reporting the problem to the user.
%message が空~文字列の場合、~custom~errorを~~空に戻す。 ◎ If the argument is the empty string, clears the custom error.
%element . `validity$m . `valueMissing$m
[ %element は必須の欄であって 値がない ならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element has no value but is a required field; false otherwise.
%element . `validity$m . `typeMismatch$m
[ %element の値は正しい構文でないならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value is not in the correct syntax; false otherwise.
%element . `validity$m . `patternMismatch$m
[ %element の値は供された~patternに合致しないならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value doesn't match the provided pattern; false otherwise.
%element . `validity$m . `tooLong$m
[ %element の値は 供された最大~長さより長いならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value is longer than the provided maximum length; false otherwise.
%element . `validity$m . `tooShort$m
[ %element の値は 空~文字列でない, かつ 供された最小~長さより短いならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value, if it is not the empty string, is shorter than the provided minimum length; false otherwise.
%element . `validity$m . `rangeUnderflow$m
[ %element の値は 供された最小より低いならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value is lower than the provided minimum; false otherwise.
%element . `validity$m . `rangeOverflow$m
[ %element の値は 供された最大より高いならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value is higher than the provided maximum; false otherwise.
%element . `validity$m . `stepMismatch$m
[ %element の値は `step$a 属性が与える規則に合わないならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value doesn't fit the rules given by the step attribute; false otherwise.
%element . `validity$m . `badInput$m
[ 利用者が~UI内に供した入力を ~UAが値に変換できないならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the user has provided input in the user interface that the user agent is unable to convert to a value; false otherwise.
%element . `validity$m . `customError$m
[ %element に~custom~errorがあるならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element has a custom error; false otherwise.
%element . `validity$m . `valid$m
[ %element の値に妥当性の問題がないならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the element's value has no validity problems; false otherwise.
%valid = %element . `checkValidity()$m
[ %element の値に妥当性の問題がないならば ~T / ~ELSE_ ~F ]を返す。 加えて, ~F を返すときは、 %element に向けて `invalid$et ~eventを発火する。 ◎ Returns true if the element's value has no validity problems; false otherwise. Fires an invalid event at the element in the latter case.
%valid = %element . `reportValidity()$m
[ %element の値に妥当性の問題がないならば ~T / ~ELSE_ ~F ]を返す。 加えて, ~F を返すときは、 %element に向けて `invalid$et ~eventを発火した上で,(~eventが取消されなかったなら)問題を利用者に報告する。 ◎ Returns true if the element's value has no validity problems; otherwise, returns false, fires an invalid event at the element, and (if the event isn't canceled) reports the problem to the user.
%element . `validationMessage$m
%element の妥当性が検査され,問題があった場合に 利用者に示されることになる~error~messageを返す。 ◎ Returns the error message that would be shown to the user if the element was to be checked for validity.
`willValidate@m
取得子は、[ 此れは`拘束検証の候補$であるならば ~T / ~ELSE_(すなわち`拘束検証の対象外$ならば) ~F ]を返さ~MUST。 ◎ The willValidate attribute's getter must return true, if this element is a candidate for constraint validation, and false otherwise (i.e., false if any conditions are barring it from constraint validation).
`setCustomValidity(message)@m
被呼出時には、[ 此れの`~custom妥当性~error~message$ ~SET %message ]に設定し~MUST。 ◎ The setCustomValidity(message) method, when invoked, must set the custom validity error message to message.

次の例では、~scriptは,~form~controlの値を編集される度に検査し、妥当な値でないならば, `setCustomValidity()$m ~methodを利用して適切な~messageを設定する。 ◎ In the following example, a script checks the value of a form control each time it is edited, and whenever it is not a valid value, uses the setCustomValidity() method to set an appropriate message.

<label>Feeling: <input name=f type="text" oninput="check(this)"></label>
<script>
 function check(%input) {
   if (%input.value == "good" ||
       %input.value == "fine" ||
       %input.value == "tired") {
     %input.setCustomValidity('"' + %input.value + '" is not a feeling.');
   } else {
     /* 
%input は申し分ない — ~error~messageを再設定する
◎
input is fine -- reset the error message
 */
     %input.setCustomValidity('');
   }
 }
</script>
`validity@m
取得子は、[ 此れの`妥当性~状態$を表現する `ValidityState$I ~obj ]を返さ~MUST。 この~objは`~live$とする。 ◎ The validity attribute's getter must return a ValidityState object that represents the validity states of this element. This object is live.
[Exposed=Window]
interface `ValidityState@I {
  readonly attribute boolean `valueMissing$m;
  readonly attribute boolean `typeMismatch$m;
  readonly attribute boolean `patternMismatch$m;
  readonly attribute boolean `tooLong$m;
  readonly attribute boolean `tooShort$m;
  readonly attribute boolean `rangeUnderflow$m;
  readonly attribute boolean `rangeOverflow$m;
  readonly attribute boolean `stepMismatch$m;
  readonly attribute boolean `badInput$m;
  readonly attribute boolean `customError$m;
  readonly attribute boolean `valid$m;
};

`ValidityState$I ~objは、次に挙げる属性を持つ。 それらの取得子は、[ 対応する条件が満たされるならば ~T / ~ELSE_ ~F ]を返さ~MUST: ◎ A ValidityState object has the following attributes. On getting, they must return true if the corresponding condition given in the following list is true, and false otherwise.

`valueMissing@m
~controlには`欠落の難あり$ ◎ The control is suffering from being missing.
`typeMismatch@m
~controlには`型~不一致の難あり$ ◎ The control is suffering from a type mismatch.
`patternMismatch@m
~controlには`~pattern不一致の難あり$ ◎ The control is suffering from a pattern mismatch.
`tooLong@m
~controlには`長過ぎる難あり$ ◎ The control is suffering from being too long.
`tooShort@m
~controlには`短か過ぎる難あり$ ◎ The control is suffering from being too short.
`rangeUnderflow@m
~controlには`~underflowの難あり$ ◎ The control is suffering from an underflow.
`rangeOverflow@m
~controlには`~overflowの難あり$ ◎ The control is suffering from an overflow.
`stepMismatch@m
~controlには`~step不一致の難あり$ ◎ The control is suffering from a step mismatch.
`badInput@m
~controlには`不良~入力の難あり$ ◎ The control is suffering from bad input.
`customError@m
~controlには`~custom~errorの難あり$ ◎ The control is suffering from a custom error.
`valid@m
上に挙げた どの条件も満たされない ◎ None of the other conditions are true.

`checkValidity()@m

被呼出時には、次を走らせ~MUST: ◎ The checkValidity() method, when invoked, must run these steps:

  1. ~IF[ 此れは`拘束検証の候補$である ]~AND[ 此れは`自身の拘束を満たす$ ]: ◎ If this element is a candidate for constraint validation and does not satisfy its constraints, then:

    1. 此れに向けて,名前 `invalid$et の`~eventを発火する$ — 次のように初期化して ⇒ `cancelable$m 属性 ~SET ~T(取消しても効果はないが) ◎ Fire an event named invalid at this element, with the cancelable attribute initialized to true (though canceling has no effect).
    2. ~RET ~F ◎ Return false.
  2. ~RET ~T ◎ Return true.
`reportValidity()@m

被呼出時には、次を走らせ~MUST: ◎ The reportValidity() method, when invoked, must run these steps:

  1. ~IF[ 此れは`拘束検証の候補$である ]~AND[ 此れは`自身の拘束を満たす$ ]: ◎ If this element is a candidate for constraint validation and does not satisfy its constraints, then:

    1. %report ~LET 此れに向けて,名前 `invalid$et の`~eventを発火する$ — 次のように初期化して ⇒ `cancelable$m 属性 ~SET ~T ◎ Let report be the result of firing an event named invalid at this element, with the cancelable attribute initialized to true.
    2. ~IF[ %report ~EQ ~T ] ⇒ 此れの拘束についての問題を 利用者に報告する — その際には、~UAは 次をしても~MAY: ◎ If report is true, then report the problems with the constraints of this element to the user. When reporting the problem with the constraints to the user, the user agent\

      • `~objを~focusする$( 此れ ) ◎ may run the focusing steps for this element, and\
      • 文書の~scrolling位置を変更する, あるいは 要素を利用者に注目させるような何らかの他の動作を遂行する ◎ may change the scrolling position of the document, or perform some other action that brings this element to the user's attention.\
      • 此れが複数の問題に難ありならば,それら複数の拘束~違反を報告する ◎ User agents may report more than one constraint violation, if this element suffers from multiple problems at once.\
      • 此れが`具現化されて$いない場合、利用者に通知する代わりに,`走っている~script$に対し`~errorを報告する$ ◎ If this element is not being rendered, then the user agent may, instead of notifying the user, report the error for the running script.
    3. ~RET ~F ◎ Return false.
  2. ~RET ~T ◎ Return true.
`validationMessage@m

取得子は、次を走らせ~MUST: ◎ The validationMessage attribute's getter must run these steps:

  1. ~IF[ 此れは`拘束検証の候補$でない ]~OR[ 此れは`自身の拘束を満たす$ ] ⇒ ~RET 空~文字列 ◎ If this element is not a candidate for constraint validation or if this element satisfies its constraints, then return the empty string.
  2. ~RET 次の要件を満たすような~message: ◎ Return a suitably localized message that\

    • 此れは、妥当性の拘束に問題がある,唯一の~form~controlである場合、利用者に示すに相応しく地域化された~message。 ◎ the user agent would show the user if this were the only form control with a validity constraint problem.\
    • ~UAが~textによる~messageを実際に示さない場合(例えば,代わりに~graphical-cueを示す場合)、~controlが満たさない( 1 個~以上の)妥当性~拘束を表し, 相応しく地域化された~message。 ◎ If the user agent would not actually show a textual message in such a situation (e.g., it would show a graphical cue instead), then return a suitably localized message that expresses (one or more of) the validity constraint(s) that the control does not satisfy.\
    • [ 此れは`拘束検証の候補$である ]~AND[ `~custom~errorの難あり$ ]の場合、結果の~message内には`~custom妥当性~error~message$が在するべきである。 【この場合の結果に,他の情報も含まれ得るのかどうかは、原文の記述からは,はっきりしない。】 ◎ If the element is a candidate for constraint validation and is suffering from a custom error, then the custom validity error message should be present in the return value.

4.10.20.4. 保安

~serverは、~client側の検証に依拠するべきでない。 敵対的な利用者は,~client側の検証を意図的に迂回でき、また 意図せずとも,これらの特色機能を実装しない[ 旧式の~UA / 自動化~tool ]の利用者により迂回され得るので。 拘束検証の特色機能が意図するのは,利用者~体験を改善することに限られており、保安については,いかなる種類の仕組みも供さない。 ◎ Servers should not rely on client-side validation. Client-side validation can be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user agents or automated tools that do not implement these features. The constraint validation features are only intended to improve the user experience, not to provide any kind of security mechanism.

4.10.21. ~form提出

4.10.21.1. 序論

~INFORMATIVE

~formが提出されるとき、~form内の~dataは,`~enctype$が指定する構造に変換された上で、所与の`~method$を用いて,`動作$に指定される行先へ送信される。 ◎ When a form is submitted, the data in the form is converted into the structure specified by the enctype, and then sent to the destination specified by the action using the given method.

例えば、次の~formでは: ◎ For example, take the following form:

`form-submission-1^xCode

利用者が 1 番目の欄に "cats", 2 番目の欄に "fur" と打込んで,提出-~buttonを叩いた場合、~UAは `/find.cgi?t=cats&q=fur^c を読込むことになる。 ◎ If the user types in "cats" in the first field and "fur" in the second, and then hits the submit button, then the user agent will load /find.cgi?t=cats&q=fur.

他方、次の~formを考える: ◎ On the other hand, consider this form:

`form-submission-2^xCode

利用者により同じ入力が与えられた下での提出の結果は,全く異なり、代わりに~UAは,所与の~URLへ向けて 次の~textに似た様な~entity本体を伴わせた~HTTP~POSTを行う: ◎ Given the same user input, the result on submission is quite different: the user agent instead does an HTTP POST to the given URL, with as the entity body something like the following text:

------kYFrd4jNJEgCervE
Content-Disposition: form-data; name="t"

cats
------kYFrd4jNJEgCervE
Content-Disposition: form-data; name="q"

fur
------kYFrd4jNJEgCervE--

4.10.21.2. 暗黙的な提出

`form$e 要素の `既定の~button@ は、それが`所有-$している`提出-~button$のうち,`木~順序$で最初のものとする。 ◎ A form element's default button is the first submit button in tree order whose form owner is that form element.

~UAが,利用者による ~formの暗黙的な提出を~supportする場合(例えば,一部の~platformでは、~text~controlが`~focusされて$いる間に enter ~keyを叩くと,~formは暗黙的に提出される)、~formの`既定の~button$に`作動化の挙動$があって, `不能化され$ていない場合に そうするときは、~UAは,その`既定の~button$に向けて`~click~eventを発火-$し~MUST。 ◎ If the user agent supports letting the user submit a form implicitly (for example, on some platforms hitting the "enter" key while a text control is focused implicitly submits the form), then doing so for a form, whose default button has activation behavior and is not disabled, must cause the user agent to fire a click event at that default button.

注記: ~Webには,~formを暗黙的に提出する仕方がある場合に限り利用できる頁もある。 したがって、~UAには,これの~supportが強く奨励される。 ◎ There are pages on the Web that are only usable if there is a way to implicitly submit forms, so user agents are strongly encouraged to support this.

~formに`提出-~button$がない場合、暗黙的な提出の仕組みは:

  • ~form内に,` 暗黙的な提出を阻む欄^i がある場合には、何もしては~MUST_NOT ⇒ ` 暗黙的な提出を阻む欄^i とは、`form$e 要素が`所有-$している `input$e 要素のうち,`type$a 属性の状態が次のいずれかにあるものとする ⇒ `Text$st, `Text$st, `Url$st, `Tel$st, `Email$st, `Password$st, `Date$st, `Month$st, `Week$st, `Time$st, `Datetime-local$st, `Number$st

  • 他の場合、次をし~MUST ⇒ `form$e 要素を それ自身から`提出する$
◎ If the form has no submit button, then the implicit submission mechanism must do nothing if the form has more than one field that blocks implicit submission, and must submit the form element from the form element itself otherwise. ◎ For the purpose of the previous paragraph, an element is a field that blocks implicit submission of a form element if it is an input element whose form owner is that form element and whose type attribute is in one of the following states: Text, Search, URL, Telephone, E-mail, Password, Date, Month, Week, Time, Local Date and Time, Number

4.10.21.3. ~form提出~algo

`form$e 要素 %~form を要素 %提出元 (概して~button)から `提出する@ ときは、~UAは,次の手続きを走らせ~MUST: ◎ When a form element form is submitted from an element submitter (typically a button),\ ◎ ↓↓optionally with a submitted from submit() method flag set, the user agent must run the following steps:

  1. ~IF[ %~form は`~navigateできない$ ] ⇒ ~RET ◎ If form cannot navigate, then return.
  2. %~form文書 ~LET %~form の`~node文書$ ◎ Let form document be the form's node document.
  3. ~IF[ `閲覧文脈~sandbox化( ~form )~flag$ ~IN %~form文書 の`作動中の~sandbox法~flag集合$ ] ⇒ ~RET ◎ If form document's active sandboxing flag set has its sandboxed forms browsing context flag set, then return.
  4. %~form閲覧文脈 ~LET %~form文書 が`属する閲覧文脈$ ◎ Let form browsing context be the browsing context of form document.
  5. `submit() から呼出された^V ~LET [ この手続きは `submit()$m ~methodから呼出されたならば ~T / ~ELSE_ ~F ] ◎ ↑↑
  6. ~IF[ `submit() から呼出された^V ~EQ ~F ]:

    1. ~IF[ %提出元 の`検証なし状態$ ~EQ ~F ]:

      1. %結果 ~LET %~form の`拘束を対話的に検証-$した結果
      2. ~IF[ %結果 ~EQ `否定的^i ]:

        1. %~form に向けて,名前 `invalid$et の`~eventを発火する$
        2. ~RET
      ◎ If the submitted from submit() method flag is not set, and the submitter element's no-validate state is false, then interactively validate the constraints of form and examine the result: if the result is negative (the constraint validation concluded that there were invalid fields and probably informed the user of this) then fire an event named invalid at the form element and then return. ◎ If the submitted from submit() method flag is not set, then:
    2. %continue ~LET %~form に向けて,名前 `submit$et の`~eventを発火する$ — 次のように初期化して ⇒# `bubbles$m 属性 ~SET ~T, `cancelable$m 属性 ~SET ~T ◎ Let continue be the result of firing an event named submit at form, with the bubbles attribute initialized to true and the cancelable attribute initialized to true.
    3. ~IF[ %continue ~EQ ~F ] ⇒ ~RET ◎ If continue is false, then return.
    4. ~IF[ %~form は`~navigateできない$ ] ⇒ ~RET ◎ If form cannot navigate, then return.

      注記: `~navigateできない$かどうか再び調べる — `submit$et ~eventを配送した結果,変化することもあるので。 ◎ Cannot navigate is run again as dispatching the submit event could have changed the outcome.

  7. %符号化法 ~LET %~form の現在の`符号化法$form ◎ Let encoding be the result of picking an encoding for the form.
  8. %~entry~list ~LET `~entry~listを構築する$( %~form, %提出元, %符号化法 ) ◎ Let entry list be the result of constructing the entry list with form, submitter, and encoding.
  9. %動作~URL ~LET %提出元 の`動作$ ◎ Let action be the submitter element's action.
  10. ~IF[ %動作~URL ~EQ 空~文字列 ] ⇒ %動作~URL ~LET %~form文書 の`~URL$doc ◎ If action is the empty string, let action be the URL of the form document.
  11. %解析済み動作 ~LET %動作~URL を %提出元 の`~node文書$に`相対的に構文解析-$した`結果の~URL~record$ ◎ Parse the URL action, relative to the submitter element's node document.\
  12. ~IF[ %解析済み動作 ~EQ ~error ] ⇒ ~RET ◎ If this fails, return. ◎ Let parsed action be the resulting URL record.
  13. %~scheme ~LET %解析済み動作 の`~scheme$url ◎ Let scheme be the scheme of parsed action.
  14. %~enctype ~LET %提出元 の`~enctype$ ◎ Let enctype be the submitter element's enctype.
  15. %~method ~LET %提出元 の`~method$ ◎ Let method be the submitter element's method.
  16. %~target ~LET [[ %提出元 は`提出-~button$である ]~AND[ %提出元 は `formtarget$a 属性~値を有する ]ならば その属性~値 / ~ELSE_ `要素の~targetを取得する$( %~form ) ] ◎ Let target be the submitter element's formtarget attribute value, if the element is a submit button and has such an attribute. Otherwise, let it be the result of getting an element's target given submitter's form owner.
  17. ( %~target閲覧文脈, %置換- ) ~LET ( %~target, %~form閲覧文脈 ) を与える下で,`閲覧文脈を選ぶ規則$を適用した結果 ◎ Let target browsing context and replace be the result of applying the rules for choosing a browsing context using target and form browsing context.
  18. ~IF[ %~target閲覧文脈 ~EQ ~NULL ] ⇒ ~RET ◎ If target browsing context is null, then return.
  19. [ %~form文書 はまだ`完全に読込まれ$ていない ]~AND[ `submit() から呼出された^V ~EQ ~T ] ⇒ %置換- ~SET ~T ◎ If form document has not yet completely loaded and the submitted from submit() method flag is set, then set replace to true.
  20. ~IF[ %~method ~EQ `dialog$st ] ⇒ `~dialogを提出する$ ◎ If the value of method is dialog then jump to the submit dialog steps.
  21. ( %~scheme, %~method ) に応じて,下の表の一列目の %~scheme に該当する行の %~method に該当する列に示される下位手続きを遂行する ◎ Otherwise, select the appropriate row in the table below based on the value of scheme as given by the first cell of each row. Then, select the appropriate cell on that row based on the value of method as given in the first cell of each column. Then, jump to the steps named in that cell and defined below the table.

    %~scheme %~method ~EQ `GET$st %~method ~EQ `POST$st
    `http^c `変異-動作~URL$ ◎ Mutate action URL `~entity本体として提出する$ ◎ Submit as entity body
    `https^c `変異-動作~URL$ ◎ Mutate action URL `~entity本体として提出する$ ◎ Submit as entity body
    `ftp^c `~Get動作~URL$ ◎ Get action URL `~Get動作~URL$ ◎ Get action URL
    `javascript^c `~Get動作~URL$ ◎ Get action URL `~Get動作~URL$ ◎ Get action URL
    `data^c `変異-動作~URL$ ◎ Mutate action URL `~Get動作~URL$ ◎ Get action URL
    `mailto^c `~header列を伴う~Mail$ ◎ Mail with headers `本体として~Mailする$ ◎ Mail as body
    その他 この仕様では定義されない — ~UAは、これを定義する別の仕様がない限り,この仕様にて 類似する~schemeに対し定義される方式と相似的に動作するべきである。 ◎ If scheme is not one of those listed in this table, then the behavior is not defined by this specification. User agents should, in the absence of another specification defining this, act in a manner analogous to that defined in this specification for similar schemes.

各 `form$e 要素 %~form には、 `計画された~navi@ がある。 それは,~NULL または ある`~task$として定義され、要素の作成-時には~NULLに設定され~MUST。 以下に述べる挙動において,特定0の資源 %行先 への `~navigateを計画する@ よう要求されたときは、次の手続きを走らせ~MUST ◎ Each form element has a planned navigation, which is either null or a task; when the form is first created, its planned navigation must be set to null. In the behaviors described below, when the user agent is required to plan to navigate to a particular resource destination, it must run the following steps:

  1. ~IF[ %~form に`計画された~navi$ ~NEQ ~NULL ] ⇒ それを`~task~queue$から除去する ◎ If the form has a non-null planned navigation, remove it from its task queue.
  2. ( %~target閲覧文脈, %置換- ) ~LET この手続きを呼出した ~formを`提出する$~algoにより設定されたそれら ◎ ↓
  3. %~form に`計画された~navi$ ~LET 次の手続きを走らす新たな`~task$: ◎ Let the form's planned navigation be a new task that consists of running the following steps:

    1. %~form に`計画された~navi$ ~SET ~NULL ◎ Let the form's planned navigation be null.
    2. [ `置換~可能化~flag$ ~SET %置換- ]の下で, %~target閲覧文脈 を %行先 へ`~navigate$する ◎ Navigate target browsing context to destination. If replace is true, then target browsing context must be navigated with replacement enabled. ◎ For the purposes of this task, target browsing context and replace are the variables that were set up when the overall form submission algorithm was run, with their values as they stood when this planned navigation was queued.
  4. ~task源に`~DOM操作~task源$を用いる下で,次を走らす`~taskを~queueする$ ⇒ %~form に`計画された~navi$ ◎ Queue the task that is the form's new planned navigation. ◎ The task source for this task is the DOM manipulation task source.

%~form を`提出する$~algoの文脈における各種~挙動は、次に従うとする: ◎ The behaviors are as follows:

`変異-動作~URL@ ◎ Mutate action URL
  1. %解析済み動作 の`~query$url ~SET `~form_urlencoded直列化器$( %~entry~list, %符号化法 ) ◎ Let query be the result of running the application/x-www-form-urlencoded serializer with entry list and encoding. ◎ Set parsed action's query component to query.
  2. %解析済み動作 への`~navigateを計画する$ ◎ Plan to navigate to parsed action.
`~entity本体として提出する@ ◎ Submit as entity body
  1. %~enctype に応じて: ◎ Switch on enctype:

    `~form_urlencoded$sT

    %本体 ~LET `~form_urlencoded直列化器$( %~entry~list, %符号化法 ) ◎ Let body be the result of running the application/x-www-form-urlencoded serializer with entry list and encoding.

    %本体 ~SET `~UTF-8符号化する$( %本体 ) ◎ Set body to the result of encoding body.

    %~MIME型 ~LET `~form_urlencoded$mt ◎ Let MIME type be "application/x-www-form-urlencoded".

    `~mp_form_data$sT
    %本体 ~LET `~mp_form_dataとして符号化する$( %~entry~list, %符号化法 ) ◎ Let body be the result of running the multipart/form-data encoding algorithm with entry list and encoding.
    %~MIME型 ~LET 次の文字列を順に連結した結果 ⇒# `multipart/form-data;^l, 1 個の文字 `0020^U SPACE, `boundary=^l, `~mp_form_dataとして符号化する$ときに生成された`~mp_form_data境界~文字列$ ◎ Let MIME type be the concatenation of the string "multipart/form-data;", a U+0020 SPACE character, the string "boundary=", and the multipart/form-data boundary string generated by the multipart/form-data encoding algorithm.
    `~text_plain$sT

    %本体 ~LET `~text_plainとして符号化する$( %~entry~list ) ◎ Let body be the result of running the text/plain encoding algorithm with entry list.

    %本体 ~SET `符号化法を用いて符号化する$( %符号化法, %本体 ) ◎ Set body to the result of encoding body using encoding.

    %~MIME型 ~LET `~text_plain^mt ◎ Let MIME type be "text/plain".

  2. 次のようにされた新たな`要請$への`~navigateを計画する$

    • `~url$rq ~SET %解析済み動作
    • `~method$rq ~SET %~method
    • `~header~list$rq ~SET ( `Content-Type^h / %~MIME型 ) のみからなる
    • `本体$rq ~SET %本体
    ◎ Plan to navigate to a new request whose url is parsed action, method is method, header list consists of `Content-Type`/MIME type, and body is body.
`~Get動作~URL@ ◎ Get action URL

%解析済み動作 への`~navigateを計画する$ ◎ Plan to navigate to parsed action.

注記: %~entry~list は破棄される。 ◎ entry list is discarded.

`~header列を伴う~Mail@ ◎ Mail with headers
  1. %~header列 ~LET `~form_urlencoded直列化器$( %~entry~list, %符号化法 ) ◎ Let headers be the result of running the application/x-www-form-urlencoded serializer with entry list and encoding.
  2. %~header列 内の各 文字 `002B^U `+^smb を 文字列 `%20^l に置換する ◎ Replace occurrences of U+002B PLUS SIGN characters (+) in headers with the string "%20".
  3. %解析済み動作 の`~query$url ~SET %~header列 ◎ Set parsed action's query to headers.
  4. %解析済み動作 への`~navigateを計画する$ ◎ Plan to navigate to parsed action.
`本体として~Mailする@ ◎ Mail as body
  1. %~enctype に応じて: ◎ Switch on enctype:

    `~text_plain$sT
    1. %本体 ~LET `~text_plainとして符号化する$( %~entry~list ) ◎ Let body be the result of running the text/plain encoding algorithm with entry list.
    2. %本体 内の ~EACH ( %符号位置 ) を次の結果に置換する ⇒ `~UTF-8~percent-符号化する$( `~path~percent-符号化-集合$, %符号位置 ) ] `URL$r ◎ Set body to the result of concatenating the result of UTF-8 percent encoding each code point in body, using the default encode set. [URL]
    その他 ◎ Otherwise
    %本体 ~LET `~form_urlencoded直列化器$( %~entry~list, %符号化法 ) ◎ Let body be the result of running the application/x-www-form-urlencoded serializer with entry list and encoding.
  2. %~query ~LET %解析済み動作 の`~query$url
  3. ~IF[ %~query ~EQ ~NULL ] ⇒ %~query ~SET 空~文字列 ◎ If parsed action's query is null, then set it to the empty string.
  4. ~IF[ %~query ~NEQ 空~文字列 ] ⇒ %~query に 1 個の文字 `0026^U `&^smb を付加する ◎ If parsed action's query is not the empty string, then append a single U+0026 AMPERSAND character (&) to it.
  5. %~query に `body=^l を付加する ◎ Append "body=" to parsed action's query.
  6. %~query に %本体 を付加する ◎ Append body to parsed action's query.
  7. %解析済み動作 の`~query$url ~SET %~query
  8. %解析済み動作 への`~navigateを計画する$ ◎ Plan to navigate to parsed action.
`~dialogを提出する@ ◎ Submit dialog
  1. %対象 ~LET %~form に最も近い先祖 `dialog$e 要素 ◎ Let subject be the nearest ancestor dialog element of form, if any.
  2. ~IF[ %対象 ~EQ ε(無い) ]~OR[ %対象 は `open$a 属性を有さない ] ⇒ ~RET — 何もしない。 ◎ If there isn't one, or if it does not have an open attribute, do nothing. Otherwise, proceed as follows:
  3. %結果 ~LET %提出元 の`値$( ε もとり得る) ◎ ↓
  4. ~IF[ %提出元 は `input$e 要素である ]~AND[ その `type$a 属性は `Image$st 状態にある ]:

    1. ( %x, %y ) ~LET `選択された座標$の ( x, y ) 成分を基数 10 の数として `~ASCII数字$列で表した結果
    2. %結果 ~SET 次を順に連結した結果 ⇒# %x, 文字 `002C^U `,^smb, %y
    ◎ If submitter is an input element whose type attribute is in the Image Button state, then let result be the string formed by concatenating the selected coordinate's x-component, expressed as a base-ten number using ASCII digits, a U+002C COMMA character (,), and the selected coordinate's y-component, expressed in the same way as the x-component. ◎ Otherwise, if submitter has a value, then let result be that value. ◎ Otherwise, there is no result.
  5. %対象 の`~dialogを閉じる$
  6. ~RET %結果 ◎ Then, close the dialog subject. If there is a result, let that be the return value.

4.10.21.4. ~entry~listの構築-法

`~entry~listを構築する@ ときは、所与の ( %~form, %提出元 (省略時は ~NULL ), %符号化法 (省略時は ~NULL ) に対し,次を走らす: ◎ The algorithm to construct the entry list given a form, an optional submitter, and an optional encoding, is as follows. If not specified otherwise, submitter is null.

  1. %~control~list ~LET [ %~form が`所有-$している`提出-可能$な要素 ]すべてからなる,`木~順序$による~list ◎ Let controls be a list of all the submittable elements whose form owner is form, in tree order.
  2. %~entry~list ~LET 新たな空`~list$ ( 0 個~以上の`~entry$fDからなる) ◎ Let entry list be a new empty list of entries.
  3. %~control~list 内の ~EACH ( %欄 ) に対し: ◎ For each element field in controls, in tree order:

    1. %状態 ~LET [ %欄 は `input$e 要素であるならば その `type$a 属性の状態 / ~ELSE_ `他の要素^i ]
    2. ~IF[ 次のいずれかが満たされる ]…: ◎ If any of the following is true:

      • %欄 の先祖に `datalist$e 要素がある ◎ The field element has a datalist element ancestor.
      • %欄 は`不能化され$ている ◎ The field element is disabled.
      • [ %欄 は`~button$である ]~AND[ %欄 ~NEQ %提出元 ] ◎ The field element is a button but it is not submitter.
      • [ %状態 ~IN { `Checkbox$st, `Radio$st } ]~AND[ %欄 の`~checkedness$ ~EQ ~F ] ◎ The field element is an input element whose type attribute is in the Checkbox state and whose checkedness is false. ◎ The field element is an input element whose type attribute is in the Radio Button state and whose checkedness is false.
      • [ %状態 ~NEQ `Image$st ]~AND[[ %欄 は `name$a 属性を有さない ]~OR[ %欄 は `name$a 属性を有していて,その値 ~EQ 空~文字列 ]] ◎ The field element is not an input element whose type attribute is in the Image Button state, and either the field element does not have a name attribute specified, or its name attribute's value is the empty string.
      • %欄 は[ `~plugin$を利用していない `object$e 要素 ]である ◎ The field element is an object element that is not using a plugin.

      …ならば ⇒ ~CONTINUE ◎ Then continue.

    3. %名 ~LET [ %欄 は `name$a 属性を有するならば その値 / ~ELSE_ 空~文字列 ] ◎ ↓
    4. %状態 に応じて, または[ %状態 ~EQ `他の要素^i ]の場合は %欄 に応じて: ◎ ↓

      • `Image$st: ◎ If the field element is an input element whose type attribute is in the Image Button state, then:

        1. ~IF[ %名 ~NEQ 空~文字列 ] ⇒ %名 の末尾に 1 個の文字 `002E^U `.^smb を付加する ◎ If the field element has a name attribute specified and its value is not the empty string, let name be that value followed by a single U+002E FULL STOP character (.). Otherwise, let name be the empty string.
        2. %x名 ~LET %名 の末尾に 1 個の文字 `0078^U `x^smb を付加した結果 ◎ Let namex be the string consisting of the concatenation of name and a single U+0078 LATIN SMALL LETTER X character (x).
        3. %y名 ~LET %名 の末尾に 1 個の文字 `0079^U `y^smb を付加した結果 ◎ Let namey be the string consisting of the concatenation of name and a single U+0079 LATIN SMALL LETTER Y character (y).
        4. ~Assert: [ %欄 ~EQ %提出元 ]~AND[ この~algoが呼出される前に,利用者は座標を指示した ] ◎ The field element is submitter, and before this algorithm was invoked the user indicated a coordinate.\
        5. ( %x, %y ) ~LET に利用者により`選択された座標$の ( %x, %y ) 成分 ◎ Let x be the x-component of the coordinate selected by the user, and let y be the y-component of the coordinate selected by the user.
        6. %~entry~list に`~entryを付加する$( %x名, %x ) ◎ Append an entry to entry list with namex and x.
        7. %~entry~list に`~entryを付加する$( %y名, %y ) ◎ Append an entry to entry list with namey and y.
        8. ~CONTINUE ◎ Continue. ◎ Let name be the value of the field element's name attribute.
      • `select$e 要素である ⇒ %欄 の`選択肢~list$内の ~EACH( `option$e 要素 %O ) に対し ⇒ ~IF[ %O の`選択有無$opt ~EQ ~T ]~AND[ %O は`不能化され$optていない ] ⇒ %~entry~list に`~entryを付加する$( %名, %O の`値$opt ) ◎ If the field element is a select element, then for each option element in the select element's list of options whose selectedness is true and that is not disabled,append an entry to entry list with name and the value of the option element.
      • `Checkbox$st / `Radio$st : ◎ Otherwise, if the field element is an input element whose type attribute is in the Checkbox state or the Radio Button state, then:

        1. %値 ~LET [ %欄 は `value$a 属性を有するならば その値 / ~ELSE_ 文字列 `on^l ] ◎ If the field element has a value attribute specified, then let value be the value of that attribute; otherwise, let value be the string "on".
        2. %~entry~list に`~entryを付加する$( %名, %値 ) ◎ Append an entry to entry list with name and value.
      • `File$st : ◎ Otherwise, if the field element is an input element whose type attribute is in the File Upload state, then:

        1. %~file~list ~LET %欄 の`選択された~file~list$ ◎ ↓
        2. ~IF[ %~file~list は空である ] ⇒ %~entry~list に`~entryを付加する$( %名, 次のようにされた新たな `File$I ~obj ) ⇒# 名前 ~SET 空~文字列, 型 ~SET `application/octet-stream$mt 本体 ~SET 空 ◎ If there are no selected files, then append an entry to entry list with name and a new File object with an empty name, application/octet-stream as type, and an empty body.
        3. ~ELSE ⇒ %~file~list 内の ~EACH( %~file ) に対し ⇒ %~entry~list に`~entryを付加する$( %名, %~file を表現する新たな `File$I ~obj ) ◎ Otherwise, for each file in selected files, append an entry to entry list with name and a File object representing the file.
      • `object$e 要素である ⇒ ~IF[ `~plugin$から~form提出~値を得れる ] ⇒ %~entry~list に`~entryを付加する$( %名, ~form提出~値 ) ◎ Otherwise, if the field element is an object element: try to obtain a form submission value from the plugin, and if that is successful, append an entry to entry list with name and the returned form submission value.
      • `Hidden$st: ◎ Otherwise, if the field element is an input element whose type attribute is in the Hidden state\

        1. ~IF[ %名 ~NEQ "`_charset_$v" ] ⇒ ~GOTO `その他^i ◎ and name is "_charset_":
        2. %charset ~LET %符号化法 に応じて ⇒# ~NULL ならば `UTF-8^l / ~ELSE_ %符号化法 の`名前$enc ◎ Let charset be the name of encoding if encoding is given, and "UTF-8" otherwise.
        3. %~entry~list に`~entryを付加する$( %名, %charset ) ◎ Append an entry to entry list with name and charset.
      • `textarea$e 要素である ⇒ %~entry~list に`~entryを付加する$( %名, %欄 の`値$, `改行は正規化しない^i ) ◎ Otherwise, if the field element is a textarea element, append an entry to entry list with name and the value of the field element, and the prevent line break normalization flag set.

        注記: `textarea$e 要素の`値$の事例では、改行の正規化は,~controlの`生の値$tAを~controlの`値$に変換する間にすでに遂行されている(それは、必要とされる行折返しも遂行する)。 ◎ In the case of the value of textarea elements, the line break normalization is already performed during the conversion of the control's raw value into the control's value (which also performs any necessary line wrapping).

      • `その他^i ⇒ %~entry~list に`~entryを付加する$( %名, %欄 の`値$ ) ◎ Otherwise, append an entry to entry list with name and the value of the field element.
    5. ~IF[ %欄 は `dirname$a 属性を有する ]~AND[ その値 ~NEQ 空~文字列 ]: ◎ If the element has a dirname attribute, and that attribute's value is not the empty string, then:

      1. %方向~名 ~LET %欄 の `dirname$a 属性の値 ◎ Let dirname be the value of the element's dirname attribute.
      2. %方向 ~LET %欄 の`方向性$に応じて[ `左横書き$ならば `ltr^l / `右横書き$ならば `rtl^l ] ◎ Let dir be the string "ltr" if the directionality of the element is 'ltr', and "rtl" otherwise (i.e., when the directionality of the element is 'rtl').
      3. %~entry~list に`~entryを付加する$( %方向~名, %方向 ) ◎ Append an entry to entry list with dirname and dir.

      注記: 要素が `dirname$a 属性を有するのは、 `textarea$e 要素であるか, または[ `input$e 要素であって その `type$a 属性の状態 ~IN { `Text$st, `Search$st } ]の場合に限られる。 ◎ An element can only have a dirname attribute if it is a textarea element or an input element whose type attribute is in either the Text state or the Search state.

  4. ~RET %~entry~list ◎ Return entry list.

%~entry~list に `~entryを付加する@ ときは、所与の ( %名, %値, %改行は正規化しない~flag ~IN { `改行は正規化しない^i, ε } (省略時は ε ) ) に対し,次を走らす: ◎ To append an entry to entry list, given name, value, and optional prevent line break normalization flag, run these steps:

  1. 以下において,所与の %文字列 の改行文字を正規化する所では ⇒ %文字列 内の各[ ~LF / ~CR ]を、それが~CRLFの一部を成さないならば,~CRLFに置換する ⇒ ここで、 ~LF は文字 `000A^U LINE FEED / ~CR は文字 `000D^U CARRIAGE RETURN / ~CRLFは 2 文字からなる並び[ ~CR ~LF ]を表すとする。 ◎ ↓
  2. %名 の改行文字を正規化する ◎ For name, replace every occurrence of U+000D (CR) not followed by U+000A (LF), and every occurrence of U+000A (LF) not preceded by U+000D (CR), by a string consisting of a U+000D (CR) and U+000A (LF).
  3. %名 を`~Unicode~scalar値~列に変換する$ ◎ Replace name with the result of converting to a sequence of Unicode scalar values.
  4. ~IF[ %値 は `File$I ~objでない ]: ◎ If value is not a File object, then:

    1. ~IF[ %改行は正規化しない~flag ~EQ ε ] ⇒ %値 の改行文字を正規化する ◎ If the prevent line break normalization flag is unset, then replace every occurrence of U+000D (CR) not followed by U+000A (LF), and every occurrence of U+000A (LF) not preceded by U+000D (CR) in value, by a string consisting of a U+000D (CR) and U+000A (LF).
    2. %値 を`~Unicode~scalar値~列に変換する$ ◎ Replace value with the result of converting to a sequence of Unicode scalar values.
  5. %~entry~list に次の結果を`付加する$ ⇒ `~entryを作成する$( %名, %値 ) ◎ Create an entry with name and value, and append it to entry list.

4.10.21.5. ~form提出 符号化法

所与の時点における, `form$e 要素 %~form の `符号化法@form は、 `符号化法から出力~符号化法を取得する$( 次の手続きを走らせた結果 ) の結果で与えられる: ◎ If the user agent is to pick an encoding for a form, it must run the following steps:

  1. ~IF[ %~form は `accept-charset$a 属性を有さない ] ⇒ ~RET `文書の符号化法$
  2. `~ASCII空白で分割する$( %~form の `accept-charset$a 属性の値 ) — その結果を成す~EACH ( ~token ) に対し ⇒ ~IF[ `~labelから符号化法を取得する$( ~token ) の結果 ~NEQ 失敗 ] ⇒ ~RET その結果
  3. ~RET `~UTF-8$
◎ • Let encoding be the document's character encoding. • If the form element has an accept-charset attribute, set encoding to the return value of running these substeps: •• Let input be the value of the form element's accept-charset attribute. •• Let candidate encoding labels be the result of splitting input on ASCII whitespace. •• Let candidate encodings be an empty list of character encodings. •• For each token in candidate encoding labels in turn (in the order in which they were found in input), get an encoding for the token and, if this does not result in failure, append the encoding to candidate encodings. •• If candidate encodings is empty, return UTF-8. •• Return the first encoding in candidate encodings. • Return the result of getting an output encoding from encoding.

4.10.21.6. ~URLに符号化された~form~data

`~form_urlencoded$mt の詳細は WHATWG URL 標準 `URL$r を見よ。 ◎ See the WHATWG URL standard for details on application/x-www-form-urlencoded. [URL]

4.10.21.7. ~multipart~form~data

`~mp_form_dataとして符号化する@ ときは、所与の ( %~entry~list, %符号化法 ) に対し,次を走らす: ◎ The multipart/form-data encoding algorithm, given an entry list and encoding, is as follows:

  1. %~entry~list 内の~EACH( `~entry$fD %~entry ) に対し: ◎ Let result be the empty string. ◎ For each entry in entry list:

    1. %~entry の[ 名, 値 ]のそれぞれに対し ⇒ その中の[ %符号化法 を用いて表せない ~EACH ( %文字 ) ]を,次を順に連結した結果の文字列に置換する ⇒# 文字 `0026^U `&^smb, 文字 `0023^U `#^smb, %文字 の符号位置を基数 10 で表現する 1 個以上の`~ASCII数字$並び, 文字 `003B^U `;^smb ◎ For each character in the entry's name and value that cannot be expressed using the selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND character (&), a U+0023 NUMBER SIGN character (#), one or more ASCII digits representing the code point of the character in base ten, and finally a U+003B (;).
  2. ~RET [ `RFC7578$r Returning Values from Forms: `~mp_form_data^mt に述べられる規則 ]を用いて, %~entry~list を符号化した結果の~byte-stream — その際には、以下に与える要件に従わ~MUST: ◎ Encode the (now mutated) entry list using the rules described by RFC 7578, Returning Values from Forms: multipart/form-data, and return the resulting byte stream. [RFC7578]

    • %~entry~list 内の各 %~entry が `field^i を与える。 %~entry の ( 名, 値 ) が ( `field name^i, `field value^i ) を与える。 ◎ Each entry in entry list is a field, the name of the entry is the field name and the value of the entry is the field value.
    • 各~部位の順序は、 %~entry~list 内の %~entry の順序と同じにする。 名が同じ 複数の %~entry は,別個の~fieldとして扱う。 ◎ The order of parts must be the same as the order of fields in entry list. Multiple entries with the same name must be treated as distinct fields.
    • 生成する `~mp_form_data$mt 資源を成す各~部位のうち:

      • ~file~field以外の~fieldに対応する部位には、 `Content-Type$h ~headerは指定しない。 それらの名と値は, %符号化法 を用いて符号化する。 ◎ The parts of the generated multipart/form-data resource that correspond to non-file fields must not have a `Content-Type` header specified. Their names and values must be encoded using the character encoding selected above.
      • ~file~fieldに対応する部位に含まれる~file名は、 %符号化法 を用いて符号化する — その精確な名前は、必要とされるなら近似してよい(例えば,名~内の[ 改行文字は除去する / 引用符は `%22^l に変更する / %符号化法 では表せない文字は他の文字に置換する ]など)。 ◎ File names included in the generated multipart/form-data resource (as part of file fields) must use the character encoding selected above, though the precise name may be approximated if necessary (e.g. newlines could be removed from file names, quotes could be changed to "%22", and characters not expressible in the selected character encoding could be replaced by other characters).

    `~mp_form_data境界~文字列@ とは、~UAが,この~algoが返す値を生成するときに利用する境界~文字列である。 (この値は、この~algoが生成する ~form提出~payloadの~MIME型を生成するときに利用される。) ◎ The boundary used by the user agent in generating the return value of this algorithm is the multipart/form-data boundary string. (This value is used to generate the MIME type of the form submission payload generated by this algorithm.)

`~mp_form_data$mt ~payloadを解釈する方法の詳細は、 `RFC7578$r を見よ。 ◎ For details on how to interpret multipart/form-data payloads, see RFC 7578. [RFC7578]

4.10.21.8. 素の~text~form~data

`~text_plainとして符号化する@ ときは、所与の ( %~entry~list ) に対し, 次を走らす: ◎ The text/plain encoding algorithm, given an entry list, is as follows:

  1. %結果 ~LET 空~文字列 ◎ Let result be the empty string.
  2. %~entry~list 内の~EACH( `~entry$fD %~entry ) に対し: ◎ For each entry in entry list:

    1. ~IF[ %~entry の値は `File$I ~objである ] ⇒ %~entry の値 ~SET %~entry の値の `~nameF$m ◎ If the entry's value is a File object, then set its value to the File object's name.
    2. %結果 に次を順に付加する ⇒# %~entry の名, 文字 `003D^U `=^smb, %~entry の値, ~CRLF ◎ Append the entry's name to result. ◎ Append a single U+003D EQUALS SIGN character (=) to result. ◎ Append the entry's value to result. ◎ Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF) character pair to result.
  3. ~RET %結果 ◎ Return result.

`~text_plain$mt 形式を利用する~payloadは、人から読まれる用途に意図される。 その形式は多義的なので、~computerからは 依拠-可能に解釈できない(例えば、値~内の~literal改行文字と 値の終端にある改行文字を判別する仕方はない)。 ◎ Payloads using the text/plain format are intended to be human readable. They are not reliably interpretable by computer, as the format is ambiguous (for example, there is no way to distinguish a literal newline in a value from the newline at the end of the value).

4.10.22. ~formの再設定-法

`~formを再設定-@ するときは、所与の `form$e 要素 %~form に対し,次を走らせ~MUST: ◎ When a form element form is reset, run these steps:

  1. %reset ~LET %~form に向けて,名前 `reset$et の`~eventを発火する$ — 次のように初期化して ⇒# `bubbles$m 属性 ~SET ~T, `cancelable$m 属性 ~SET ~T ◎ Let reset be the result of firing an event named reset at form, with the bubbles and cancelable attributes initialized to true.
  2. ~IF[ %reset ~EQ ~T ] ⇒ %~form が`所有-$している ~EACH ( `再設定-可能$な %要素 ) に対し ⇒ %要素 の`再設定~algo$を呼出す ◎ If reset is true, then invoke the reset algorithm of each resettable element whose form owner is form.

各 `再設定-可能$な要素は、自前の `再設定~algo@ を定義する。 それらの~algoの一部として,~form~controlに加えられた変更は、利用者による変更には数えられない(したがって、例えば `input$et ~eventを発火させることはない)。 ◎ Each resettable element defines its own reset algorithm. Changes made to form controls as part of these algorithms do not count as changes caused by the user (and thus, e.g., do not cause input events to fire).