2.6. 共通の DOM ~interface

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

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

2.6.1. ~IDL属性による内容~属性の反映-法

一部の~IDL属性は、特定0の内容~属性を `反映-@ するものと定義される。 これは、その~IDL属性の[ 取得子 / 設定子 ]は,内容~属性の[ 現在の値を返す / 値を所与の値に変更する ]ことを意味する。 ◎ Some IDL attributes are defined to reflect a particular content attribute. This means that on getting, the IDL attribute returns the current value of the content attribute, and on setting, the IDL attribute changes the value of the content attribute to the given value.

以下,この節における `~IDL属性@V は、ある `要素@V 上の,ある `内容~属性@V を`反映-$しているものとする。 加えて:

  • `内容~値@V は、 `要素$V が `内容~属性$V を[ 有するならば その値 / 有さないならば ε ]とする。
  • `既定~値@V は、 `~IDL属性$V に対する既定の値が定義されて[ いるならば その値 / いなければ ε ]とする。
  • `指定~値@V は、 `~IDL属性$V の設定子に渡された値(~WebIDLに則って, `~IDL属性$V の型に変換された結果の値)を表すとする。

一般に,[ `内容~値$V ~EQ ε ]の下では、 `~IDL属性$V は: ◎ In general,\

  • 取得子は、(他が指定されない限り)[ `内容~値$V ~EQ 空~文字列 ]であったかのように動作し~MUST。 ◎ on getting, if the content attribute is not present, the IDL attribute must act as if the content attribute's value is the empty string; and\
  • 設定子は、先ず, `要素$V に `内容~属性$V を追加し~MUST。 ◎ on setting, if the content attribute is not present, it must first be added.

`USVString$I 型の `~IDL属性$V の挙動は、[ `内容~属性$V が 1 個の`~URL$を値にとる ]ものと定義されているならば,以下の定義に従わ~MUST: ◎ If a reflecting IDL attribute is a USVString attribute whose content attribute is defined to contain a URL, then\

  • 取得子は、次を走らす: ◎ on getting,\

    1. ~IF[ `内容~値$V ~EQ ε ] ⇒ ~RET 空~文字列 ◎ if the content attribute is absent, the IDL attribute must return the empty string.\
    2. %~url ~LET `内容~値$V を `要素$V の`~node文書$に`相対的に構文解析-$した`結果の~URL文字列$ ◎ Otherwise, the IDL attribute must parse the value of the content attribute relative to the element's node document and\
    3. ~IF [ %~url ~NEQ ~error ] ⇒ ~RET %~url ] ◎ if that is successful, return the resulting URL string.\
    4. ~RET `内容~値$V を `USVString$I 型に変換した結果 ◎ If parsing fails, then the value of the content attribute must be returned instead, converted to a USVString.\
  • 設定子は、次を走らす ⇒ `内容~属性$V の値 ~SET `指定~値$V ◎ On setting, the content attribute must be set to the specified new value.

`DOMString$I 型の `~IDL属性$V の挙動は、[ `内容~属性$V が`列挙ed属性$である ]ならば,以下の定義に従わ~MUST: ◎ If a reflecting IDL attribute is a DOMString attribute whose content attribute is an enumerated attribute, and\

`~IDL属性$V は、ある集合 %S 内の `既知の値のみに制限され@ ている場合: ◎ the IDL attribute is limited to only known values, then,\

取得子は、次を走らす: ◎ on getting, the IDL attribute must\

  1. ~IF[ `内容~値$V は[ %S 内の ある値 %V に結付けられている状態 ]を表現している ] ⇒ ~RET %V ( %V の文字大小は、正準的なそれとする) ◎ return the conforming value associated with the state the attribute is in (in its canonical case), if any, or\
  2. ~RET 空~文字列 ◎ the empty string if the attribute is in a state that has no associated keyword value or if the attribute is not in a defined state (e.g. the attribute is missing and there is no missing value default).\
設定子は、次を走らす ⇒ `内容~属性$V の値 ~SET `指定~値$V ◎ On setting, the content attribute must be set to the specified new value.
`~IDL属性$V は~nullableである場合: ◎ If a reflecting IDL attribute is a nullable DOMString attribute whose content attribute is an enumerated attribute, then,\

取得子は、次を走らす: ◎ on getting,\

  1. ~IF[ `内容~属性$V の状態 ~EQ `値なし用の既定$の状態 ] ⇒ ~RET ~NULL ◎ if the corresponding content attribute is in its missing value default then the IDL attribute must return null,\
  2. ~RET `内容~属性$V の状態に結付けられている適合~値(正準的な文字大小とする) ◎ otherwise, the IDL attribute must return the conforming value associated with the state the attribute is in (in its canonical case).\

設定子は、次を走らす: ◎ On setting,\

  1. ~IF[ `指定~値$V ~EQ ~NULL ] ⇒ `要素$V から `内容~属性$V を除去する ◎ if the new value is null, the content attribute must be removed, and\
  2. ~ELSE ⇒ `内容~属性$V の値 ~SET `指定~値$V ◎ otherwise, the content attribute must be set to the specified new value.

上述に該当しない `DOMString$I 型, または `USVString$I 型の `~IDL属性$V の[ 取得子/設定子 ]は、文字大小を保全するように透過的に[ 取得する/設定する ]とする。 【すなわち、この節の冒頭に示した,一般~規則にそのまま従う。】 ◎ If a reflecting IDL attribute is a DOMString or USVString attribute but doesn't fall into any of the above categories, then the getting and setting must be done in a transparent, case-preserving manner.

`boolean$I 型の `~IDL属性$V の挙動は、以下の定義に従わ~MUST: ◎ If a reflecting IDL attribute is a boolean attribute, then\

  • 取得子は、次を走らす: ◎ on getting\

    1. ~IF[ `内容~値$V ~NEQ ε ] ⇒ ~RET ~T ◎ the IDL attribute must return true if the content attribute is set, and\
    2. ~RET ~F ◎ false if it is absent.\
  • 設定子は、次を走らす: ◎ On setting,\

    1. ~IF[ `指定~値$V ~EQ ~F ] ⇒ `要素$V 上から `内容~属性$V を除去する ◎ the content attribute must be removed if the IDL attribute is set to false, and\
    2. ~ELSE ⇒ `内容~属性$V の値 ~SET 空~文字列 ◎ must be set to the empty string if the IDL attribute is set to true.\

(これらは、`真偽~内容~属性$の規則に対応する。) ◎ (This corresponds to the rules for boolean content attributes.)

有符号~整数~型( `long$I )の `~IDL属性$V は、以下の定義に従わ~MUST:

  • この種の `~IDL属性$V には、 `非負~数のみに制限され@ るものもある。 ◎ ↓
  • 取得子は、次を走らす:

    1. ~IF[ `内容~値$V ~NEQ ε ]:
      1. %V ~LET `内容~値$V
      2. ~IF[ `~IDL属性$V は`非負~数のみに制限され$ている ] ⇒ %V ~SET `非負~整数として構文解析する$( %V )
      3. ~ELSE ⇒ %V ~SET `整数として構文解析する$( %V )
      4. ~IF[ %V ~NEQ ~error ]~AND[ %V ~IN `~IDL属性$V の型がとり得る範囲 ] ⇒ ~RET %V
    2. ~IF [ `既定~値$V ~NEQ ε ] ⇒ ~RET `既定~値$V
    3. ~RET [ `~IDL属性$V は`非負~数のみに制限され$ているならば −1 / ~ELSE_ 0 ]
    ◎ If a reflecting IDL attribute has a signed integer type (long) then, on getting, the content attribute must be parsed according to the rules for parsing signed integers, and if that is successful, and the value is in the range of the IDL attribute's type, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, then the default value must be returned instead, or 0 if there is no default value.\ ◎ On setting, the given value must be converted to the shortest possible string representing the number as a valid integer and then that string must be used as the new content attribute value. ◎ If a reflecting IDL attribute has a signed integer type (long) that is limited to only non-negative numbers then, on getting, the content attribute must be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range of the IDL attribute's type, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or −1 if there is no default value.\ ◎ On setting, if the value is negative, the user agent must throw an "IndexSizeError" DOMException. Otherwise, the given value must be converted to the shortest possible string representing the number as a valid non-negative integer and then that string must be used as the new content attribute value.
  • 設定子は、次を走らす:

    1. ~IF[ `~IDL属性$V は`非負~数のみに制限され$ている ]~AND[ `指定~値$V ~LT 0 ] ⇒ ~THROW `IndexSizeError$E
    2. `内容~属性$V の値 ~SET `指定~値$V を表現するような`妥当な整数$のうち,可能な限り最短の文字列
    ◎ ↑

無符号~整数~型( `unsigned long$I )の `~IDL属性$V は、以下の定義に従わ~MUST:

  • この種の `~IDL属性$V には、次のいずれかに該当するものもある:
    • (A) `非~zero数に制限され@る
    • (B) `~fallbackありの下で非~zero数に制限され@る
    • (C) ある最小, 最大による`範囲に切詰められ@る

    (B) / (C) の場合、~fallbackとして,常に何らかの `既定~値$V が定義される。

    ◎ ↓
  • 取得子は、次を走らす:

    1. %V ~LET ~error
    2. ~IF[ `内容~値$V ~NEQ ε ] ⇒ %V ~SET `非負~整数として構文解析する$( `内容~値$V )
    3. ~IF[ `~IDL属性$V は上述の (C) に該当する ] ⇒ ~RET [ %V ~EQ ~error ならば `既定~値$V / ~ELSE_ %V を所与の範囲に切詰めた結果 ]
    4. %下限 ~LET [ `~IDL属性$V は上述の (A), (B) いずれかに該当するならば 1 / ~ELSE_ 0 ]
    5. ~IF[ %V ~NEQ ~error ]~AND[ %V ~IN { %下限 〜 2147483647 } ] ⇒ ~RET %V
    6. ~RET[ `既定~値$V ~NEQ ε ならば `既定~値$V / ~ELSE_ %下限 ]
    ◎ If a reflecting IDL attribute has an unsigned integer type (unsigned long) then, on getting, the content attribute must be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 0 if there is no default value.\ ◎ On setting, first, if the new value is in the range 0 to 2147483647, then let n be the new value, otherwise let n be the default value, or 0 if there is no default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value. ◎ If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is limited to only non-negative numbers greater than zero, then the behavior is similar to the previous case, but zero is not allowed. On getting, the content attribute must first be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 1 if there is no default value.\ ◎ On setting, if the value is zero, the user agent must throw an "IndexSizeError" DOMException. Otherwise, first, if the new value is in the range 1 to 2147483647, then let n be the new value, otherwise let n be the default value, or 1 if there is no default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value. ◎ If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is limited to only non-negative numbers greater than zero with fallback, then the behavior is similar to the previous case, but disallowed values are converted to the default value. On getting, the content attribute must first be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead.\ ◎ On setting, first, if the new value is in the range 1 to 2147483647, then let n be the new value, otherwise let n be the default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value. ◎ If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is clamped to the range [min, max], then on getting, the content attribute must first be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is between min and max inclusive, the resulting value must be returned. If it fails, the default value must be returned. If it succeeds but the value is less than min, min must be returned. If it succeeds but the value is greater than max, max must be returned.\ ◎ On setting, it behaves the same as setting a regular reflected unsigned integer.
  • 設定子は、次を走らす:

    1. %V ~LET `指定~値$V
    2. ~IF[ `~IDL属性$V は上述の (A) に該当する ]~AND[ %V ~EQ 0 ] ⇒ ~THROW `IndexSizeError$E
    3. %下限 ~LET [ `~IDL属性$V は上述の (A), (B) いずれかに該当するならば 1 / ~ELSE_ 0 ]
    4. ~IF[ %V ~NIN { %下限 〜 2147483647 } ] ⇒ %V ~SET [ `既定~値$V ~NEQ ε ならば `既定~値$V / ~ELSE_ %下限 ]
    5. `内容~属性$V の値 ~SET %V を表現するような`妥当な整数$のうち,可能な限り最短の文字列
    【設定子に関しては、 (C) に対する特別な扱いはない】 ◎ ↑

浮動小数点数~型( `double$I / `unrestricted double$I )の `~IDL属性$V は、以下の定義に従わ~MUST:

  • この種の `~IDL属性$V には、 `正数に制限され@ るものもある。 ◎ ↓
  • 取得子は、次を走らす:

    1. ~IF[ `内容~値$V ~NEQ ε ]:

      1. %V ~LET `浮動小数点数として構文解析する$( `内容~値$V )
      2. ~IF[ %V ~NEQ ~error ]:

        1. ~IF[ `~IDL属性$V は`正数に制限され$ていない ]~OR[ %V ~GT 0.0 ] ⇒ ~RET %V
    2. ~IF [ `既定~値$V ~NEQ ε ] ⇒ ~RET `既定~値$V
    3. ~RET 0.0
    ◎ If a reflecting IDL attribute has a floating-point number type (double or unrestricted double), then, on getting, the content attribute must be parsed according to the rules for parsing floating-point number values, and if that is successful, the resulting value must be returned. If, on the other hand, it fails, or if the attribute is absent, the default value must be returned instead, or 0.0 if there is no default value.\ ◎ On setting, the given value must be converted to the best representation of the number as a floating-point number and then that string must be used as the new content attribute value. ◎ If a reflecting IDL attribute has a floating-point number type (double or unrestricted double) that is limited to numbers greater than zero, then the behavior is similar to the previous case, but zero and negative values are not allowed. On getting, the content attribute must be parsed according to the rules for parsing floating-point number values, and if that is successful and the value is greater than 0.0, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 0.0 if there is no default value.\ ◎ On setting, if the value is less than or equal to zero, then the value must be ignored. Otherwise, the given value must be converted to the best representation of the number as a floating-point number and then that string must be used as the new content attribute value.
  • 設定子は、次を走らす:

    1. ~IF[ `~IDL属性$V は`正数に制限され$ている ]~AND[ `指定~値$V ~LTE 0 ] ⇒ ~RET (無視する)
    2. `内容~属性$V の値 ~SET `指定~値$V を`浮動小数点数として最良の表現$に変換した結果
    ◎ ↑

注記: ~WebIDL仕様にて定義されるように、実数~型の~IDL属性の設定子に対する値 Infinity, NaN( Not-a-Number )は、例外を投出させる。 `WEBIDL$r ◎ The values Infinity and Not-a-Number (NaN) values throw an exception on setting, as defined in the Web IDL specification. [WEBIDL]

`DOMTokenList$I 型の `~IDL属性$V の挙動は、以下の定義に従わ~MUST: ◎ If a reflecting IDL attribute has the type DOMTokenList, then\

  • 取得子は、次を満たすような `DOMTokenList$I ~obj %O を返す: ◎ on getting it must return a DOMTokenList object\

    • %O に 結付けられている要素 ~EQ `要素$V ◎ whose associated element is the element in question and\
    • %O に結付けられている 属性の局所~名 ~EQ `内容~属性$V の名前 ◎ whose associated attribute's local name is the name of the attribute in question.

2.6.2. ~collection

[ `HTMLFormControlsCollection$I / `HTMLOptionsCollection$I ]~interfaceは、 `HTMLCollection$I ~interfaceから派生する`~collection$である。 `HTMLAllCollection$I ~interfaceは、`~collection$であるが,そのように派生されるものではない。 ◎ The HTMLFormControlsCollection and HTMLOptionsCollection interfaces are collections derived from the HTMLCollection interface. The HTMLAllCollection interface is a collection, but is not so derived.

2.6.2.X. 共通の定義

【 この節は、共通の記述を集約するために,この訳に導入したものである。 】

所与の[ `HTMLFormControlsCollection$I / `HTMLOptionsCollection$I ]~obj %C に対し:

  • “%N 番” という表記は、 %C で`表現され$る要素のうち,`木~順序$で ( %N ~PLUS 1 ) 個目にある~nodeを指す。
  • 所与の文字列 %name に `~IDか名前が一致する要素たち@ とは、 %C で`表現され$る要素のうち,次のいずれかを満たすものからなる `木~順序$による~listを意味する:

    • `id$a 属性を有していて その値 ~EQ %name
    • `name$a 属性を有していて その値 ~EQ %name
  • %C が `~supportする~prop名を収集する@ ときは、次を走らす:

    1. %名前~集合 ~LET 新たな`有順序~集合$
    2. %C により`表現され$る ~EACH ( %要素 ) に対し,`木~順序$で:

      1. ~IF[ %要素 は `id$a 属性を有する ]~AND[ その値 %V ~NEQ 空~文字列 ] ⇒ %名前~集合 に %V を`付加する$set
      2. ~IF[ %要素 は `name$a 属性を有する ]~AND[ その値 %V ~NEQ 空~文字列 ] ⇒ %名前~集合 に %V を`付加する$set
    3. ~RET %名前~集合

`name@a 属性は、[ `option$e 要素に対しては,その `~nameO$a 属性 / 他の要素に対しては,その `~nameF$a 属性 ]を指すとする。

`新たな空option@ とは、 新たに作成される `option$e 要素であって,属性も子~nodeも伴わないものとする。

2.6.2.1. `HTMLAllCollection^I ~interface

【 `document.all$m 専用の,旧来の特色機能。 この節の和訳は、省略する。 】

2.6.2.2. `HTMLFormControlsCollection^I ~interface

`HTMLFormControlsCollection$I ~interfaceは `form$e 要素~内に`~listされる要素$からなる`~collection$に利用される。 ◎ The HTMLFormControlsCollection interface is used for collections of listed elements in form elements.

[Exposed=Window]
interface `HTMLFormControlsCollection@I : `HTMLCollection$I {
  // `~length0$m, `item()$m を継承する
  getter (`RadioNodeList$I or `Element$I)? `namedItem$m(DOMString name); // 継承された `~namedItem0()$m を隠蔽する
};

[Exposed=Window]
interface `RadioNodeList@I : `NodeList$I {
  attribute DOMString `value$m;
};
%collection . `length$m
%collection 内の要素の個数を返す。 ◎ Returns the number of elements in the collection.
%element = %collection . `item(index)$m
%element = %collection[%index]
%collection 内の %index 番の~itemを返す。 ◎ Returns the item with index index from the collection. The items are sorted in tree order.
%element = %collection . `namedItem(name)$m
%radioNodeList = %collection . `namedItem(name)$m
%element = %collection[%name]
%radioNodeList = %collection[%name]
%collection 内で, %name に`~IDか名前が一致する要素たち$を返す。 ◎ Returns the item with ID or name name from the collection.
合致する要素が複数ある場合、それらすべてからなる `RadioNodeList$I ~objが返される。 ◎ If there are multiple matching items, then a RadioNodeList object containing all those elements is returned.
%radioNodeList . `value$m [ = %value ]
この~objにより表現される~radio-buttonであって,~checkされているもののうち,最初のものの値を返す。 ◎ Returns the value of the first checked radio button represented by the object.
設定して,~objにより表現される~radio-buttonであって, `value$a に %value を伴うもののうち,最初のものを~checkできる。 ◎ Can be set, to check the first radio button with the given value represented by the object.

`HTMLFormControlsCollection$I ~obj %C に対しては:

  • %C が`~supportする~prop~index$は、 `HTMLCollection$I ~objに対し定義されるそれになる。 ◎ The object's supported property indices are as defined for HTMLCollection objects.
  • %C が`~supportする~prop名$は、その時点における次の結果として定義される ⇒ %C が`~supportする~prop名を収集する$ ◎ The supported property names consist of the non-empty values of all the id and name attributes of all the elements represented by the collection, in tree order, ignoring later duplicates, with the id of an element preceding its name if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry.
`namedItem(name)@m

被呼出時には、次を走らせ~MUST: ◎ The namedItem(name) method must act according to the following algorithm:

  1. ~IF[ %name ~EQ 空~文字列 ] ⇒ ~RET ~NULL ◎ If name is the empty string, return null and stop the algorithm.
  2. ~IF[ 此れ内で, %name に`~IDか名前が一致する要素たち$は 1 個だけある ] ⇒ ~RET その要素 ◎ If, at the time the method is called, there is exactly one node in the collection that has either an id attribute or a name attribute equal to name, then return that node and stop the algorithm.
  3. ~IF[ 此れ内で, %name に`~IDか名前が一致する要素たち$はない ] ⇒ ~RET ~NULL ◎ Otherwise, if there are no nodes in the collection that have either an id attribute or a name attribute equal to name, then return null and stop the algorithm.
  4. ~RET [ 此れ内で, %name に`~IDか名前が一致する要素たち$ ]の~viewを表現するような,新たな[ `~liveである$ `RadioNodeList$I ~obj ] ◎ Otherwise, create a new RadioNodeList object representing a live view of the HTMLFormControlsCollection object, further filtered so that the only nodes in the RadioNodeList object are those that have either an id attribute or a name attribute equal to name. The nodes in the RadioNodeList object must be sorted in tree order. ◎ Return that RadioNodeList object.

`RadioNodeList$I ~interfaceが `NodeList$I ~interfaceから継承する~memberは、 `NodeList$I ~obj上にあるかのようにふるまわ~MUST。 ◎ Members of the RadioNodeList interface inherited from the NodeList interface must behave as they would on a NodeList object.

`value@m

この~IDL属性の目的においては、次が定義される:

  • `要素を見出す^i 手続きは、所与の ( 条件 %条件 ) の下で,[ 要素, または ε ]を返す:

    1. ~IF[ 次をすべて満たす要素はある ]…:

      • この `RadioNodeList$I ~objにより`表現され$る要素である
      • `input$e 要素である
      • `type$a 属性は `Radio$st 状態にある
      • %条件 は、要素に関して満たされる

      …ならば ⇒ ~RET 該当する要素のうち,`木~順序$で最初の要素

    2. ~RET ε
  • 所与の要素の `value^i は、次で与えられるとする ⇒ 要素は `value$a 内容~属性を[ 有するならば その値 / 有さないならば文字列 `on^l ]
【これらの定義は、以下を簡潔に表現するために,この訳に導入している。】 ◎ ↓

取得子は、次を走らせた結果を返さ~MUST: ◎ The value IDL attribute on the RadioNodeList object, on getting, must return the value returned by running the following steps:

  1. %要素 ~LET 次の条件の下で,`要素を見出す^i ⇒ 要素の`~checkedness$ ~EQ ~T ◎ Let element be the first element in tree order represented by the RadioNodeList object that is an input element whose type attribute is in the Radio Button state and whose checkedness is true. Otherwise, let it be null.
  2. ~IF[ %要素 ~EQ ε ] ⇒ ~RET ~NULL ◎ If element is null, return the empty string.
  3. ~RET %要素 の `value^i ◎ If element is an element with no value attribute, return the string "on". ◎ Otherwise, return the value of element's value attribute.

設定子は、次を走らせ~MUST: ◎ On setting, the value IDL attribute must run the following steps:

  1. %要素 ~LET 次の条件の下で,`要素を見出す^i ⇒ 要素の `value^i ~EQ 所与の値 ◎ If the new value is the string "on": let element be the first element in tree order represented by the RadioNodeList object that is an input element whose type attribute is in the Radio Button state and whose value content attribute is either absent, or present and equal to the new value, if any. If no such element exists, then instead let element be null. ◎ Otherwise: let element be the first element in tree order represented by the RadioNodeList object that is an input element whose type attribute is in the Radio Button state and whose value content attribute is present and equal to the new value, if any. If no such element exists, then instead let element be null.
  2. ~IF[ %要素 ~NEQ ε ] ⇒ %要素 の `~checkedness$ ~SET ~T ◎ If element is not null, then set its checkedness to true.

2.6.2.3. `HTMLOptionsCollection^I ~interface

`HTMLOptionsCollection$I ~interfaceは、 `option$e 要素たちの`~collection$に利用される。 その根は,常に `select$e 要素にされ、その子孫を操作する属性や~methodを備える。 ◎ The HTMLOptionsCollection interface is used for collections of option elements. It is always rooted on a select element and has attributes and methods that manipulate that element's descendants.

[Exposed=Window]
interface `HTMLOptionsCollection@I : `HTMLCollection$I {
  // `item()$m, `~namedItem0()$m を継承する
  [`CEReactions$] attribute unsigned long `length$m; // 継承された `~length0$m を隠蔽する
  [`CEReactions$] `setter$m void (unsigned long index, `HTMLOptionElement$I? option);
  [`CEReactions$] void `add$m((`HTMLOptionElement$I or `HTMLOptGroupElement$I) element, optional (`HTMLElement$I or long)? before = null);
  [`CEReactions$] void `remove$m(long index);
  attribute long `selectedIndex$m;
};
%collection . `length$m [ = %value ]

%collection 内の要素の個数 %N を返すことに加え: ◎ Returns the number of elements in the collection.

  • %value ~LT %N の場合、 %collection の根~内から最後の ( %N − %value ) 個の `option$e 要素を~~削る。 ◎ When set to a smaller number, truncates the number of option elements in the corresponding container.
  • %value ~GT %N の場合、 %collection の根~内に ( %value − %N ) 個の`新たな空option$を追加する。 ◎ When set to a greater number, adds new blank option elements to that container.
%element = %collection . `item(index)$m
%element = %collection[%index]
%collection 内の %index 番の~itemを返す。 ◎ Returns the item with index index from the collection. The items are sorted in tree order.
%collection[%index] = %element
%index ~GT ( %collection 内の~itemの個数 ) の場合、 %collection の根~内に`新たな空option$を追加する。 ◎ When index is a greater number than the number of items in the collection, adds new blank option elements in the corresponding container.
%element ~EQ ~NULL の場合、 %collection から %index 番の~itemを除去する。 ◎ When set to null, removes the item at index index from the collection.
%element が `option$e 要素である場合、 %element を %collection の %index 番の~itemとして追加するか,または %collection の %index 番の~itemを %element に置換する。 ◎ When set to an option element, adds or replaces it at index index from the collection.
%element = %collection . `namedItem(name)$m
%element = %collection[%name]
[ %collection 内で, %name に`~IDか名前が一致する要素たち$ ]のうち,最初のものを返す。 ◎ Returns the item with ID or name name from the collection. ◎ If there are multiple matching items, then the first is returned.
%collection . `add(element [, before ] )$m

%before 引数が指す~nodeの前に %element を挿入する:

  • %before が数の場合、 %element は, %collection 内の %before 番の~itemの前に挿入される
  • %before が %collection 内の要素である場合、 %element はその要素の前に挿入される。
  • %before が[ 省略されている / ~NULL / 範囲~外の数である ]場合、 %element は~listの末尾に追加される。
◎ Inserts element before the node given by before. ◎ The before argument can be a number, in which case element is inserted before the item with that number, or\ ◎ an element from the collection, in which case element is inserted before that element. ◎ If before is omitted, null, or a number out of range, then element will be added at the end of the list.
%element が 挿入-先の要素( %collection の根)の先祖である場合、 `HierarchyRequestError$E を投出する。 ◎ This method will throw a "HierarchyRequestError" DOMException if element is an ancestor of the element into which it is to be inserted.
【 %before が %collection 内にない要素である場合、 `NotFoundError$E を投出する。 】
%collection . `remove(index)$m
%collection から %index 番の~itemを除去する。 ◎ Removes the item with index index from the collection.
%collection . `selectedIndex$m [ = %value ]
選択されている~itemが[ あれば それらのうち最初の~itemの~index / なければ −1 ]を返す。 ◎ Returns the index of the first selected item, if any, or −1 if there is no selected item.
設定して,選択を変更できる。 ◎ Can be set, to change the selection.

`HTMLOptionsCollection$I ~objが`~supportする~prop~index$は、 `HTMLCollection$I ~objに対し定義されるそれになる。 ◎ The object's supported property indices are as defined for HTMLCollection objects.

`length@m
取得子は、此れにより`表現され$る~nodeの個数を返さ~MUST。 ◎ On getting, the length attribute must return the number of nodes represented by the collection.

設定子は、次を走らせ~MUST: ◎ On setting,\

  1. %n ~LET 所与の値 − ( 此れにより`表現され$る~nodeの個数 ) ◎ the behavior depends on whether the new value is equal to, greater than, or less than the number of nodes represented by the collection at that time.\
  2. ~IF[ %n ~EQ 0 ] ⇒ ~RET ◎ If the number is the same, then setting the attribute must do nothing.\
  3. ~IF[ %n ~GT 0 ] ⇒ 此れの根である `select$e 要素に[ %n 個の`新たな空option$ ]を付加した上で、[ これらの空optionを包含する `DocumentFragment$I ]が挿入されたかのように,変異~eventを発火する ◎ If the new value is greater, then n new option elements with no attributes and no child nodes must be appended to the select element on which the HTMLOptionsCollection is rooted, where n is the difference between the two numbers (new value minus old value). Mutation events must be fired as if a DocumentFragment containing the new option elements had been inserted.\
  4. ~ELSE ⇒ 此れ内の最後の ( − %n ) 個の~nodeを親~nodeから除去する ◎ If the new value is lower, then the last n nodes in the collection must be removed from their parent nodes, where n is the difference between the two numbers (old value minus new value).
注記: `optgroup$e 要素に関しては、 `length$m に何かを設定しても,(根である `select$e 要素~内で)[ それが除去される / それが追加される / それに新たな子が追加される ]ことは、決してない(それの子は除去され得るが)。 ◎ Setting length never removes or adds any optgroup elements, and never adds new children to existing optgroup elements (though it can remove children from them).

`HTMLOptionsCollection$I ~obj %C が`~supportする~prop名$は、その時点における次の結果として定義される ⇒ %C が`~supportする~prop名を収集する$ ◎ The supported property names consist of the non-empty values of all the id and name attributes of all the elements represented by the collection, in tree order, ignoring later duplicates, with the id of an element preceding its name if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry.

~UAは、 `HTMLOptionsCollection$I ~obj %C 上で[ `新たな有index~propの値を設定する$ / `既存の有index~propの値を設定する$ ]ときは,所与の ( ~prop~index %index, 新たな値 %値 ) に対し、次を走らせ~MUST: ◎ When the user agent is to set the value of a new indexed property or set the value of an existing indexed property for a given property index index to a new value value, it must run the following algorithm:

  1. ~IF[ %値 ~EQ ~NULL ]:

    1. %index を引数に, %C 上の `remove()$m ~methodの手続きを呼出す
    2. ~RET
    ◎ If value is null, invoke the steps for the remove method with index as the argument, and return.
  2. %select ~LET %C の根である `select$e 要素 ◎ ↓
  3. %n ~LET %index − ( %C により`表現され$る~nodeの個数 ) ◎ Let length be the number of nodes represented by the collection. ◎ Let n be index minus length.
  4. ~IF[ %n ~GT 0 ] ⇒ %select に`~nodeを付加する$( ( %n-1 ) 個の`新たな空option$を子に持つ `DocumentFragment$I ) ◎ If n is greater than zero, then append a DocumentFragment consisting of n-1 new option elements with no attributes and no child nodes to the select element on which the HTMLOptionsCollection is rooted.
  5. ~IF[ %n ~GTE 0 ] ⇒ %select に`~nodeを付加する$( %値 ) ◎ If n is greater than or equal to zero, append value to the select element.\
  6. ~ELSE ⇒ `子を~nodeに置換する$( %C 内の %index 番の要素, %値 ) ◎ Otherwise, replace the indexth element in the collection by value.
`add(element, before)@m

被呼出時には、次を走らせ~MUST ◎ The add(element, before) method must act according to the following algorithm:

  1. %select ~LET 此れの根である `select$e 要素 ◎ ↓
  2. ~IF[ %element は %select の先祖である ] ⇒ ~THROW `HierarchyRequestError$E ◎ If element is an ancestor of the select element on which the HTMLOptionsCollection is rooted, then throw a "HierarchyRequestError" DOMException.
  3. ~IF[ %before は要素である ]: ◎ If before is an element,\

    1. ~IF[ %before は %select の子孫でない ] ⇒ ~THROW `NotFoundError$E ◎ but that element isn't a descendant of the select element on which the HTMLOptionsCollection is rooted, then throw a "NotFoundError" DOMException.
    2. ~IF[ %element ~EQ %before ] ⇒ ~RET ◎ If element and before are the same element, then return.
  4. ~ELSE( %before は整数である) ⇒ %before ~SET [ 此れ内に %before 番の~nodeはあるならば それ / ~ELSE_ ~NULL ] ◎ If before is a node, then let reference be that node. Otherwise, if before is an integer, and there is a beforeth node in the collection, let reference be that node. Otherwise, let reference be null.
  5. %親 ~LET[ %before ~NEQ ~NULL ならば %before の親~node / ~ELSE_ %select ] ◎ If reference is not null, let parent be the parent node of reference. Otherwise, let parent be the select element on which the HTMLOptionsCollection is rooted.
  6. %親 の中で`~nodeを子の前に前挿入する$( %element, %before ) ◎ Pre-insert element into parent node before reference.
`remove(index)@m

被呼出時には、次を走らせ~MUST: ◎ The remove(index) method must act according to the following algorithm:

  1. ~IF[ 0 ~LTE %index ~LT ( 此れにより`表現され$る~nodeの個数 ) ] ⇒ 此れ内の %index 番の要素をその親から除去する ◎ If the number of nodes represented by the collection is zero, return. ◎ If index is not a number greater than or equal to 0 and less than the number of nodes represented by the collection, return. ◎ Let element be the indexth element in the collection. ◎ Remove element from its parent node.
`selectedIndex@m
取得子は、此れの根である `select$e 要素~上の同じ名前の~IDL属性と同様に動作し~MUST。 ◎ The selectedIndex IDL attribute must act like the identically named attribute on the select element on which the HTMLOptionsCollection is rooted

2.6.3. `DOMStringList$I ~interface

`DOMStringList$I ~interfaceは、文字列の~listを昔風の仕方で表現する。 ◎ The DOMStringList interface is a non-fashionable retro way of representing a list of strings.

[Exposed=(Window,Worker)]
interface `DOMStringList@I {
  readonly attribute unsigned long `length$sL;
  getter DOMString? `item$sL(unsigned long %index);
  boolean `contains$sL(DOMString %string);
};

新たな~APIは、 `DOMStringList$I ではなく, `sequence<DOMString>^c または それに等価なものを利用し~MUST。 ◎ New APIs must use sequence<DOMString> or equivalent rather than DOMStringList.

%strings . `length$sL
%strings が包含している文字列の個数を返す。 ◎ Returns the number of strings in strings.
%strings[%index]
%strings . `item(index)$sL
%strings 内の~index %index 番の文字列を返す。 ◎ Returns the string with index index from strings.
%strings . `contains(string)$sL
%strings が %string を[ 包含するならば ~T / ~ELSE_ ~F ]を返す ◎ Returns true if strings contains string, and false otherwise.

各 `DOMStringList$I ~objには`~list$ `文字列~list^i が結付けられる。 ◎ Each DOMStringList object has an associated list.

`DOMStringList$I ~obj %O が`~supportする~prop~index$は、 0 以上[ %O の`文字列~list^iの`~size$ ]未満とする。 ◎ The supported property indices for a DOMStringList object are the numbers zero to the associated list's size minus one. If its associated list is empty, it has no supported property indices.

`length@sL
取得子は、次を返さ~MUST ⇒ 此れの`文字列~list^iの`~size$ ◎ The length attribute's getter must return this DOMStringList object's associated list's size.
`item(index)@sL

被呼出時には、次を走らせ~MUST:

  1. %~list ~LET 此れの`文字列~list^i
  2. ~IF[ %index ~LT %~list の`~size$ ] ⇒ ~RET %~list[ %index ]
  3. ~RET ~NULL
◎ The item(index) method, when invoked, must return the indexth item in this DOMStringList object's associated list, or null if index plus one is greater than this DOMStringList object's associated list's size.
`contains(string)@sL
被呼出時には、次を返さ~MUST ⇒# %string ~IN 此れの`文字列~list^i ならば ~T / ~ELSE_ ~F ◎ The contains(string) method, when invoked, must return true if this DOMStringList object's associated list contains string, and false otherwise.

2.6.4. ~garbage収集

存在していた( pre-existing ) ~objを返す~IDL属性からは、その~objへの `暗黙の強い参照@ がある。 ◎ There is an implied strong reference from any IDL attribute that returns a pre-existing object to that object.

例えば `window.document$m 属性は、`Window$I ~objから その `Document$I ~objへの強い参照があることを意味する。 同様に,`文書$から子孫~nodeへの, および ~nodeから その`~node文書$への強い参照が常にある。 ◎ For example, the window.document attribute means that there is a strong reference from a Window object to its Document object. Similarly, there is always a strong reference from a Document to any descendant nodes, and from any node to its node document.