Window, WindowProxy

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

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

7.3. `Window^I ~obj

【 以下,この訳では、 `Window$I ~interfaceを実装する~objを単に ~window とも略記する。 この略記は、この頁に限らず,この仕様の他の頁の和訳でも利用される — この節を指す~linkが付与された “`~window$” は、 `Window$I ~objを表すとする。 】

[Global=Window,
 Exposed=Window,
 LegacyUnenumerableNamedProperties]
interface `Window@I : `EventTarget$I {
  /* 現在の閲覧文脈
◎
the current browsing context
 */
  [Unforgeable] readonly attribute `WindowProxy$I `window$m;
  [Replaceable] readonly attribute `WindowProxy$I `self$m;
  [Unforgeable] readonly attribute `Document$I `document$m;
  attribute DOMString `name$m; 
  [PutForwards=`href$m, Unforgeable] readonly attribute `Location$I `location$m;
  readonly attribute `History$I `history$m;
  readonly attribute `CustomElementRegistry$I `customElements$m;
  [Replaceable] readonly attribute `BarProp$I `locationbar$m;
  [Replaceable] readonly attribute `BarProp$I `menubar$m;
  [Replaceable] readonly attribute `BarProp$I `personalbar$m;
  [Replaceable] readonly attribute `BarProp$I `scrollbars$m;
  [Replaceable] readonly attribute `BarProp$I `statusbar$m;
  [Replaceable] readonly attribute `BarProp$I `toolbar$m;
  attribute DOMString `status$m;
  void `close$m();
  readonly attribute boolean `closed$m;
  void `stop$m();
  void `focus$m();
  void `blur$m();

  /* 他の閲覧文脈
◎
other browsing contexts
 */
  [Replaceable] readonly attribute `WindowProxy$I `frames$m;
  [Replaceable] readonly attribute unsigned long `length$m;
  [Unforgeable] readonly attribute `WindowProxy$I? `top$m;
  attribute any `opener$m;
  [Replaceable] readonly attribute `WindowProxy$I? `parent$m;
  readonly attribute `Element$I? `frameElement$m;
  `WindowProxy$I? `open$m(
      optional USVString %url = "about:blank",
      optional DOMString %target = "_blank",
      optional [TreatNullAs=EmptyString] DOMString %features = ""
  );
  `getter$m `object$ (DOMString %name);  /* これは大域~objなので、 IDL 有名~prop取得子は,~prototype-chain上に `NamedPropertiesObject^I ~exotic~objを追加する。
~~実際、これが大域~objを~exotic~objにすることはない。
~indexによる~accessは `WindowProxy$I ~exotic~objが引き受ける。
◎
Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic object on the prototype chain. Indeed, this does not make the global object an exotic object. Indexed access is taken care of by the WindowProxy exotic object.
 */

  /* ~UA
◎
the user agent
 */
  readonly attribute `Navigator$I `navigator$m; 
  readonly attribute `ApplicationCache$I `applicationCache$m;

  /* 利用者~向けの~prompt
◎
user prompts
 */
  void `alert$m();
  void `alert$m(DOMString %message);
  boolean `confirm$m(optional DOMString %message = "");
  DOMString? `prompt$m(
      optional DOMString %message = "",
      optional DOMString %default = ""
  );
  void `print$m();

  unsigned long `requestAnimationFrame$m(`FrameRequestCallback$I %callback);
  void `cancelAnimationFrame$m(unsigned long %handle);

  void `postMessage$m(
      any %message,
      USVString %targetOrigin,
      optional sequence<`object$> %transfer =[]
  );
};
`Window$I includes `GlobalEventHandlers$I;
`Window$I includes `WindowEventHandlers$I;

callback `FrameRequestCallback@I = void (`DOMHighResTimeStamp$I %time);
%window . `window$m
%window . `frames$m
%window . `self$m
これらの属性はいずれも %window を返す。 ◎ These attributes all return window.
%window . `document$m
%window に`結付けられている文書$を返す。 ◎ Returns the Document associated with window.
%document . `defaultView$m
`作動中の文書$を`結付けている~window$を返す。 ◎ Returns the Window object of the active document.

各`~window$には、`文書$が `結付けられる@doc 。 それは、`~window$の作成-時に初期 `about_blank$sc `文書$に設定され、`~navi$の間に限り,そこから変化する。 ◎ The Window has an associated Document, which is a Document object. It is set when the Window object is created, and only ever changed during navigation from the initial about:blank Document.

`~window$ %W に`結付けられている文書$が`属する閲覧文脈$を指して、単に, %W に `対応する閲覧文脈@ という — それは、 %W を包装している `WindowProxy$I ~objを結付けている`閲覧文脈$と言っても同じである(無ければ ε になる)。

【 この用語は、簡便に記すため,この訳にて導入したもの。 ~APIの記述にて、単に “the 閲覧文脈” としか記されていない箇所も,この用語に置換している。 】

`window@m
`frames@m
`self@m
これらの属性の取得子は、此れに`対応する閲覧文脈$の `WindowProxy$I ~objを返さ~MUST。 ◎ The window, frames, and self IDL attributes, on getting, must all return this Window object's browsing context's WindowProxy object.
`document@m
取得子は、此れに`結付けられている文書$を返さ~MUST。 ◎ The document IDL attribute, on getting, must return this Window object's associated Document.
注記: `~window$に`結付けられている文書$が変化し得る事例は、唯一,[ `~navigate$ ~algoが,`閲覧文脈$内に最初の頁を読込むために`新たな文書を初期化する$ ]ときに限られる。 その事例では、元の `about_blank$sc 頁の `~window$が再利用され,新たな`文書$を取得する。 ◎ The Document object associated with a Window object can change in exactly one case: when the navigate algorithm initializes a new Document object for the first page loaded in a browsing context. In that specific case, the Window object of the original about:blank page is reused and gets a new Document object.

`Document$I 上の `defaultView@m 取得子は、[ 此れが`属する閲覧文脈$ ~NEQ ε ならば その `WindowProxy$I ~obj / ~ELSE_ ~NULL ]を返さ~MUST。 ◎ The defaultView IDL attribute of the Document interface, on getting, must return this Document's browsing context's WindowProxy object, if this Document has an associated browsing context, or null otherwise.


歴史的~事由から、各`~window$は、次の特徴を備える~propを持た~MUST:

  • writable, configurable, 非 enumerable
  • 名前: `HTMLDocument@l
  • 値: `Document$I interface object
◎ For historical reasons, Window objects must also have a writable, configurable, non-enumerable property named HTMLDocument whose value is the Document interface object.

7.3.1. 閲覧文脈を名前で作成-/~navigateするための~API

%window = %window . `open$m( [ %url [, %target [, %features ] ] ] )
~windowを開いて %url (省略時は `about_blank$sc )を示した上で、それを返す。 %target 引数には,新たな~windowの名前を与える。 その名前の~windowがすでに存在する場合、それが再利用される。 %features 引数を利用すれば、新たな~windowの描画に波及させられる。 ◎ Opens a window to show url (defaults to about:blank), and returns it. The target argument gives the name of the new window. If a window exists with that name already, it is reused. The features argument can be used to influence the rendering of the new window.
%window . `name$m [ = %value ]
この~windowの名前を返す。 ◎ Returns the name of the window.
設定して,名前を変更できる。 ◎ Can be set, to change the name.
%window . `close$m()
この~windowを閉じる。 ◎ Closes the window.
%window . `closed$m
この~windowは[ すでに閉じられたなら ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if the window has been closed, false otherwise.
%window . `stop$m()
文書の読込を取消す。 ◎ Cancels the document load.

`~window~open手続き@ は、所与の ( 文字列 %url, 文字列 %target, 文字列 %features ) に対し,次を走らす: ◎ The window open steps, given a string url, a string target, and a string features, are as follows:

  1. %入口~設定群 ~LET `入口~設定群~obj$ ◎ Let entry settings be the entry settings object.
  2. %~source閲覧文脈 ~LET %入口~設定群 により指定される`担当の閲覧文脈$enV ◎ Let source browsing context be the responsible browsing context specified by entry settings.
  3. ~IF[ %target ~EQ 空~文字列 ] ⇒ %target ~SET `_blank^l ◎ If target is the empty string, then set target to "_blank".
  4. %特色機能~map ~LET %features を`特色機能として~token化$した結果 ◎ Let tokenizedFeatures be the result of tokenizing features.
  5. %noopener ~LET [ %特色機能~map[ `noopener^l ] ~NEQ ε ならば ~T / ~ELSE_ ~F ] ◎ Let noopener be true if tokenizedFeatures contains an entry with the key "noopener"
  6. ( %~target閲覧文脈, %新 ) ~LET 次を与える下で,`閲覧文脈を選ぶ規則$を適用した結果 ⇒ ( %target, %~source閲覧文脈, %noopener ) ◎ Let target browsing context and new be the result of applying the rules for choosing a browsing context given target, source browsing context, and noopener.

    例えば~UAが、 control+~clickにより,~linkを新たな~tabに開くことを~supportしていて,利用者が要素に対し それを行ったとき、対する `onclick^m ~handlerは `iframe$e 内に頁を開くために `window.open()$m ~APIを利用していた場合、~UAは,~target閲覧文脈の選定を上書きして,新たな~tabを~targetにすることもできる。 ◎ If there is a user agent that supports control-clicking a link to open it in a new tab, and the user control-clicks on an element whose onclick handler uses the window.open() API to open a page in an iframe element, the user agent could override the selection of the target browsing context to instead target a new tab.

  7. ~IF[ %~target閲覧文脈 ~EQ ~NULL ] ⇒ ~RET ~NULL ◎ If target browsing context is null, then return null.
  8. ~IF[ %新 ~EQ ~T ] ⇒ `閲覧文脈の特色機能を設定しておく$( %~target閲覧文脈, %特色機能~map ) `CSSOMVIEW$r ◎ If new is true, then set up browsing context features for target browsing context given tokenizedFeatures. [CSSOMVIEW]
  9. %資源~URL ~LET "`about_blank$sc" ◎ Let resource be the URL "about:blank".
  10. ~IF[ %url ~NEQ 空~文字列 ]~OR[ %新 ~EQ ~T ]: ◎ If url is not the empty string or new is true, then:

    1. ~IF[ %url ~NEQ 空~文字列 ]:

      1. %資源~URL ~LET %url を %入口~設定群 に`相対的に構文解析-$した`結果の~URL~record$
      2. ~IF[ %資源~URL ~EQ ~error ] ⇒ ~THROW `SyntaxError$E
      ◎ If url is not the empty string, then parse url relative to entry settings, and set resource to the resulting URL record, if any. If the parse a URL algorithm failed, then throw a "SyntaxError" DOMException.
    2. ~IF[ %資源~URL ~EQ "`about_blank$sc" 【同等?】 ]~AND[ %新 ~EQ ~T ] ⇒ 次を走らす`~taskを~queueする$ ⇒ %~target閲覧文脈 の`~window$に向けて,名前 `load$et の`~eventを発火する$( `~targetを上書きする^i ) ◎ If resource is "about:blank" and new is true, then queue a task to fire an event named load at target browsing context's Window object, with the legacy target override flag set.
    3. ~ELSE ⇒ 次を与える下で, %~target閲覧文脈 を %資源~URL へ`~navigate$する(例外投出あり) ⇒# `例外~可能化~flag$ ~SET ~ON, `置換~可能化~flag$ ~SET [ %新 ~EQ ~T ならば ~ON / ~ELSE_ ~OFF ], `~source閲覧文脈$ ~SET %~source閲覧文脈 ◎ Otherwise, navigate target browsing context to resource, with the exceptions enabled flag set. If new is true, then replacement must be enabled. The source browsing context is source browsing context. Rethrow any exceptions.
  11. ~IF[ %noopener ~EQ ~T ] ⇒# %~target閲覧文脈 の`未所有化~flag$ ~SET ~ON; ~RET ~NULL ◎ If noopener is true, then disown target browsing context and return null.
  12. ~RET %~target閲覧文脈 の `WindowProxy$I ~obj ◎ Return target browsing context's WindowProxy object.
`open(url, target, features)@m
この~methodは、[ 既存の`閲覧文脈$を`~navigate$する / `補助~閲覧文脈$を開いて~navigateする ]ための仕組みを供する。 ◎ The open(url, target, features) method on Window objects provides a mechanism for navigating an existing browsing context or opening and navigating an auxiliary browsing context.
被呼出時には、次を走らせ~MUST ⇒ `~window~open手続き$( %url, %target, %features ) ◎ When the method is invoked, the user agent must run the window open steps with url, target, and features.

%features 引数を `特色機能として~token化@ するときは、次を走らす: ◎ To tokenize the features argument:

  1. %特色機能~map ~LET 新たな`有順序~map$ ◎ Let tokenizedFeatures be a new ordered map.
  2. %位置 ~LET %features の最初の符号位置を指している`位置~変数$ ◎ Let position point at the first code point of features.
  3. ~WHILE[ %位置↗ ~NEQ ε ]: ◎ While position is not past the end of features:

    1. %名前 ~LET 空~文字列 ◎ Let name be the empty string.
    2. %値 ~LET 空~文字列 ◎ Let value be the empty string.
    3. %features 内の %位置 から,`特色機能~区切子$である`符号位置~並びを収集する$ — これは、特色機能~名より前に現れる区切子を読飛ばす ◎ Collect a sequence of code points that are feature separators from features given position. This skips past leading separators before the name.
    4. %名前 ~SET 次を順に適用した結果 ⇒# %features 内の %位置 から,`特色機能~区切子$でない`符号位置~並びを収集する$; その結果を`~ASCII小文字~化する$; その結果を`特色機能~名として正規化する$ ◎ Collect a sequence of code points that are not feature separators from features given position. Set name to the collected characters, converted to ASCII lowercase. ◎ Set name to the result of normalizing the feature name name.
    5. ~WHILE[ %位置↗ ~NIN { ε, `003D^U `=^smb } ] ◎ While position is not past the end of features and the code point at position in features is not U+003D (=):

      1. ~IF[ %位置↗ ~EQ `002C^U `,^smb ]~OR[ %位置↗ ~NIN { `特色機能~区切子$ } ] ⇒ ~BREAK ◎ If the code point at position in features is U+002C (,), or if it is not a feature separator, then break.
      2. %位置 ~INCBY 1 ◎ Advance position by 1.

      注記: これは、最初の `003D^U `=^smb まで, かつ[ `002C^U `,^smb / 非~区切子 ]を過ぎない所まで読飛ばす ◎ This skips to the first U+003D (=) but does not skip past a U+002C (,) or a non-separator.

    6. ~IF[ %位置↗ ~IN { `特色機能~区切子$ } ]: ◎ If the code point at position in features is a feature separator:

      1. ~WHILE[ %位置 ~IN { `特色機能~区切子$ } ]: ◎ While position is not past the end of features and the code point at position in features is a feature separator:

        1. ~IF[ %位置↗ ~EQ `002C^U `,^smb ] ⇒ ~BREAK ◎ If the code point at position in features is U+002C (,), then break.
        2. %位置 ~INCBY 1 ◎ Advance position by 1.

        注記: これは、最初の非~区切子まで, かつ `002C^U `,^smb を過ぎない所まで読飛ばす ◎ This skips to the first non-separator but does not skip past a U+002C (,).

      2. %値 ~SET 次を順に適用した結果 ⇒# %features 内の %位置 から,`特色機能~区切子$でない`符号位置~並びを収集する$; その結果を`~ASCII小文字~化する$ ◎ Collect a sequence of code points that are not feature separators code points from features given position. Set value to the collected code points, converted to ASCII lowercase.
    7. ~IF[ %名前 ~NEQ 空~文字列 ] ⇒ %特色機能~map[ %名前 ] ~SET %値 ◎ If name is not the empty string, then set tokenizedFeatures[name] to value.
  4. ~RET %特色機能~map ◎ Return tokenizedFeatures.

次に挙げる符号位置は、 `特色機能~区切子@ とされる ⇒ `~ASCII空白$, `003D^U `=^smb, `002C^U `,^smb ◎ A code point is a feature separator if it is ASCII whitespace, U+003D (=), or U+002C (,).

旧来の理由から、一部の特色機能~名には別名がある。 所与の %名前 を `特色機能~名として正規化する@ ときは、 %名前 に応じて,次の表の 2 列目に与える結果を返す: ◎ For legacy reasons, there are some aliases of some feature names. To normalize a feature name name, switch on name:

%名前 結果
`screenx^l `left^l
`screeny^l `top^l
`innerwidth^l `width^l
`innerheight^l `height^l
その他 %名前
◎ "screenx" Return "left". "screeny" Return "top". "innerwidth" Return "width". "innerheight" Return "height". Anything else Return name.
`name@m
取得子は、此れに`対応する閲覧文脈$の現在の`名前$を返さ~MUST。 ◎ The name attribute of the Window object must, on getting, return the current name of the browsing context; and,\
設定子は、此れに`対応する閲覧文脈$の`名前$を新たな値に設定し~MUST。 ◎ on setting, set the name of the browsing context to the new value.
注記: `名前$は、閲覧文脈が別の`生成元$へ`~navigate$されたときは, 再設定される 。 ◎ The name gets reset when the browsing context is navigated to another origin.
`close()@m

被呼出時には、次を走らす~SHOULDである:

  1. %A ~LET 此れに`対応する閲覧文脈$
  2. %B ~LET `現任の設定群~obj$により指定される`担当の閲覧文脈$enV
  3. ~IF[ %A は`~scriptから閉じれる$ ]~AND[ %B は %A に`近しい$ ]~AND[ %B は %A を`~navigateすることは許容されて$いる ] ⇒ `閲覧文脈を閉じる$( %A )
◎ The close() method on Window objects should, if all the following conditions are met, close the browsing context A: • The corresponding browsing context A is script-closable. • The responsible browsing context specified by the incumbent settings object is familiar with the browsing context A. • The responsible browsing context specified by the incumbent settings object is allowed to navigate the browsing context A.

次のいずれかを満たす`閲覧文脈$は、 `~scriptから閉じれる@ とされる:

  • ~scriptが作成した`補助~閲覧文脈$である(利用者による動作ではなく)
  • [ `~top-level閲覧文脈$である ]~AND[ その`~session履歴$に含まれる`文書$は 1 つだけである ]
◎ A browsing context is script-closable if it is an auxiliary browsing context that was created by a script (as opposed to by an action of the user), or if it is a top-level browsing context whose session history contains only one Document.
`closed@m
取得子は、[ 此れに`対応する閲覧文脈$はすでに`破棄-$されたならば ~T / ~ELSE_ ~F ]を返さ~MUST。 ◎ The closed attribute on Window objects must return true if the Window object's browsing context has been discarded, and false otherwise.
`stop()@m

被呼出時には、次を走らす~SHOULDである:

  1. ~IF[ 此れに`対応する閲覧文脈$を`~navigate$しようとする既存の試みがある ]~AND[ その試みは`文書を~unloadする$~algoを現在~走らせていない ] ⇒ `文書を中止する$( 此れに`対応する閲覧文脈$にて`作動中の文書$ ) (これは、当の`~navi$を取消す。)
◎ The stop() method on Window objects should, if there is an existing attempt to navigate the browsing context and that attempt is not currently running the unload a document algorithm, cancel that navigation; then, it must abort the active document of the browsing context of the Window object on which it was invoked.

7.3.2. 他の閲覧文脈への~access法

%window . `length$m
`文書~木に属する子~閲覧文脈$の個数を返す。 ◎ Returns the number of document-tree child browsing contexts.
%window[%index]
`文書~木に属する子~閲覧文脈$のうち, %index で指示されるものを返す。 ◎ Returns the indicated document-tree child browsing context.
`length@m
取得子は、此れに`結付けられている文書$が`属する閲覧文脈$の`文書~木に属する子~閲覧文脈$たちの個数を返さ~MUST ◎ The number of document-tree child browsing contexts of a Window object W is the number of document-tree child browsing contexts of W's associated Document's browsing context. ◎ The length IDL attribute's getter must return the number of document-tree child browsing contexts of this Window object.

注記: ~indexによる`文書~木に属する子~閲覧文脈$への~accessは、 `WindowProxy$I ~objの `GetOwnProperty$sl 内部~methodを通して定義される。 ◎ Indexed access to document-tree child browsing contexts is defined through the [[GetOwnProperty]] internal method of the WindowProxy object.

7.3.3. `Window^I ~objに対する名前による~access

%window[%name]
指示された要素(たち)の~collectionを返す。 ◎ Returns the indicated element or collection of elements.
一般に、これに依拠すると,~codeは壊れやすくなる。 例えば、~Web~platformに新たな特色機能が追加されるに伴い,どの ID がこの~APIに対応付けられるかは時を経るに伴い変わり得るので。 代わりに, `document.getElementById()^m / `document.querySelector()^m を利用すること。 ◎ As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to this API can vary over time, as new features are added to the Web platform, for example. Instead of this, use document.getElementById() or document.querySelector().

`~window$ %W の `文書~木に属する子~閲覧文脈~名~prop集合@ は、次の手続きの結果で与えられる: ◎ The document-tree child browsing context name property set of a Window object window is the return value of running these steps:

  1. %名前~list ~LET 空~list ◎ ↓
  2. %文書 ~LET %W に`対応する閲覧文脈$にて`作動中の文書$ ◎ Let activeDocument be window's browsing context's active document.
  3. %子~閲覧文脈~list ~LET %文書 が`属する閲覧文脈$の`文書~木に属する子~閲覧文脈$たちからなる~list ◎ Let childBrowsingContexts be all document-tree child browsing contexts of activeDocument's browsing context whose\
  4. %子~閲覧文脈~list 内の ~EACH( %B ) に対し:

    1. %名前 ~LET %B の`閲覧文脈~名$
    2. ~IF[ %名前 ~EQ 空~文字列 ]~OR[ %名前 ~IN %名前~list ] ⇒ ~CONTINUE
    3. ~IF[ %名前 ~NEQ %B の`閲覧文脈~容器$の `name^a 内容~属性~値 ]~AND[ ( %B にて`作動中の文書$の`生成元$, %文書 の`生成元$ ) は`同一生成元$でない ] ⇒ ~CONTINUE
    4. %名前~list に %名前 を付加する
    ◎ browsing context name is not the empty string, in order, and including only the first document-tree child browsing context with a given name if multiple document-tree child browsing contexts have the same one. ◎ Remove each browsing context from childBrowsingContexts whose active document's origin is not same origin with activeDocument's origin and whose browsing context name does not match the name of its browsing context container's name content attribute value.
  5. ~RET %名前~list ◎ Return the browsing context names of childBrowsingContexts, in the same order.

例えば次の頁が `https://example.org/^c にて~hostされていて, `https://elsewhere.example/^c の `iframe^e の `name$m が `spices^l に設定されたとするとき、すべてが読込まれた後に `window.spices^c を評価した結果は undefined になる: ◎ This means that in the following example, hosted on https://example.org/, assuming https://elsewhere.example/ sets window.name to "spices", evaluating window.spices after everything has loaded will yield undefined:

<iframe src=https://elsewhere.example.com/></iframe>
<iframe name=spices></iframe>

各`~window$は、`有名~propを~supportする$。 所与の任意の時点における`~window$ %W が`~supportする~prop名$は、次のものからなる: ◎ The Window object supports named properties. The supported property names of a Window object window at any moment consist of the following, in tree order according to the element that contributed them, ignoring later duplicates:

  • %W の`文書~木に属する子~閲覧文脈~名~prop集合$ ◎ window's document-tree child browsing context name property set;
  • [ %W に`対応する閲覧文脈$にて`作動中の文書$ ]内にある`有名~要素$の`要素~名$ — `要素~名$が同じものが複数あるときは、`木~順序$で最初のもの以外は無視する。

    所与の`文書$ %文書 内の `有名~要素@, およびその `要素~名@ は、次で与えられる:

    • %文書 を`根$とする`文書~木~内$にある[ `embed$e, `form$e, `frameset$e, `img$e, `object$e ]要素のうち,[ `name^a 内容~属性を有していて,その値 ~NEQ 空~文字列 ]なるもの — その属性~値が`要素~名$を与える
    • %文書 を`根$とする`文書~木~内$にある`~HTML要素$のうち,[ `id$a 内容~属性を有していて,その値 ~NEQ 空~文字列 ]なるもの — その属性~値が`要素~名$を与える

    【 `有名~要素$, `要素~名$は、記述を論理的に集約するためにこの訳に導入した用語であり,この節でしか利用されない。 】

    ◎ the value of the name content attribute for all embed, form, frameset, img, and object elements that have a non-empty name content attribute and are in a document tree with window's browsing context's active document as their root; and ◎ the value of the id content attribute for all HTML elements that have a non-empty id content attribute and are in a document tree with window's browsing context's active document as their root.

`~window$ %W において,所与の %名前 に対し`有名~propの値を決定する$ときは、次の手続きの結果を返さ~MUST: ◎ To determine the value of a named property name in a Window, the user agent must return the value obtained using the following steps:

  1. ~Assert: %名前 は %W が`~supportする~prop名$である 【この段は、この訳による補完。】
  2. %~obj~list ~LET %W に`対応する閲覧文脈$にて`作動中の文書$内の[ 名前 %名前 の`有名~obj$ ]からなる~list ◎ Let objects be the list of named objects with the name name.

    注記: 定義により、 %~obj~list は空でない。 ◎ There will be at least one such object, by definition.

  3. ~IF[ %~obj~list 内に`入子の閲覧文脈$はある ] ⇒ ~RET[ それらのうち,`閲覧文脈~容器$の`木~順序$で最初のもの ]の `WindowProxy$I ~obj ◎ If objects contains a nested browsing context, then return the WindowProxy object of the nested browsing context corresponding to the first browsing context container in tree order whose nested browsing context is in objects.
  4. ~IF[ %~obj~list 内の要素~数 ~EQ 1 ] ⇒ ~RET その要素 ◎ Otherwise, if objects has only one element, return that element.
  5. ~RET 次のようにされた `HTMLCollection$I ⇒# 根: `Document$I ~node, ~filter: 名前 %名前 の`有名~obj$のみに合致する(定義により,これらはすべて要素になる) ◎ Otherwise return an HTMLCollection rooted at the Document node, whose filter matches only named objects with the name name. (By definition, these will all be elements.)

この節の目的における,`文書$ %文書 内の[ 名前 %名前 の `有名~obj@ ]は、次に挙げるものからなる: ◎ Named objects with the name name, for the purposes of the above algorithm, consist of the following:

  • %文書 が`属する閲覧文脈$の`文書~木に属する子~閲覧文脈$のうち,[ その`閲覧文脈~名$ ~EQ %名前 ]なるもの ◎ document-tree child browsing contexts of the active document whose name is name;
  • %文書 内の`有名~要素$のうち,[ その`要素~名$ ~EQ %名前 ]なるもの ◎ embed, form, frameset, img, or object elements that have a name content attribute whose value is name and are in a document tree with the active document as their root; and ◎ HTML elements that have an id content attribute whose value is name and are in a document tree with the active document as their root.

7.3.4. ~garbage収集と閲覧文脈

~UAは、各[ `~top-level閲覧文脈$ ]への強い参照を持つ。 ◎ ↓

各 `閲覧文脈$ %B は、[ 各[ %B に`属する文書$ ], %B の `WindowProxy$I ~obj ]への強い参照を持つ ◎ A browsing context has a strong reference to each of its Documents and its WindowProxy object, and the user agent itself has a strong reference to its top-level browsing contexts.

各`文書$は、それを`結付けている~window$への強い参照を持つ。 ◎ A Document has a strong reference to its Window object.

注記: `~window$は、その `document$m 属性を通して,それに`結付けられている文書$への`強い参照$を持つ。 したがって、他の~scriptからの,それらいずれかの~objへの参照は、両者とも存続させ続けることになる。 同様に、[ `文書$, `~window$ ]のいずれも, `WindowProxy$I ~objへの暗黙の`強い参照$を持つ。 ◎ A Window object has a strong reference to its Document object through its document attribute. Thus, references from other scripts to either of those objects will keep both alive. Similarly, both Document and Window objects have implied strong references to the WindowProxy object.

各`~script$は、自身の`設定群~obj$への強い参照を持つ。 各 `環境~設定群~obj$は、自身の[ `大域~obj$, `担当の閲覧文脈$enV, `担当の文書$enV ]への強い参照を持つ(もしあれば)。 ◎ Each script has a strong reference to its settings object, and each environment settings object has strong references to its global object, responsible browsing context, and responsible document (if any).

`文書を破棄する@ ときは、所与の ( `文書$ %文書 ) に対し,次を走らせ~MUST: ◎ To discard a Document document:

  1. 【~Assert: %文書 が`属する閲覧文脈$ ~NEQ ε 】
  2. %文書 の`回復可能~状態$ ~SET ~F ◎ Set document's salvageable state to false.
  3. この仕様も含む`適用-可能な仕様$に定義される`文書~unload時の片付け手続き$があれば、それらの各~手続きを %文書 を渡して走らす ◎ Run any unloading document cleanup steps for document that are defined by this specification and other applicable specifications.
  4. `文書を中止する$( %文書 ) ◎ Abort document.
  5. ~queueされた`~task$のうち,[ それに結付けられている`文書$ ~EQ %文書 ]なるものは、どの`~task源$からの~taskであれ,走らすことなく除去する ◎ Remove any tasks associated with document in any task source, without running those tasks.
  6. %文書 を`通して入子にされ$ている ~EACH( `子~閲覧文脈$ %B ) に対し ⇒ `閲覧文脈を破棄する$( %B ) ◎ Discard all the child browsing contexts of document.
  7. %文書 が`属する閲覧文脈$から %文書 への強い参照を断ち切る ◎ Lose the strong reference from document's browsing context to document.
  8. ~EACH( `WorkerGlobalScope$I ~obj %G ) に対し ⇒ %G の`所有者~集合$から( %文書 を包含していれば) %文書 を`除去する$ ◎ Remove document from the owner set of each WorkerGlobalScope object whose set contains document.

`閲覧文脈を破棄する@ ときは、所与の ( `閲覧文脈$ %B ) に対し,次をし~MUST: ◎ When a browsing context is discarded,\

  • ~UA自身から %B への強い参照を断ち切る ◎ the strong reference from the user agent itself to the browsing context must be severed, and\
  • [ `属する閲覧文脈$ ~EQ %B ]を満たす ~EACH( %文書 ) に対し ⇒ `文書を破棄する$( %文書 ) ◎ all the Document objects for all the entries in the browsing context's session history must be discarded as well.

~UAは: ◎ ↓

  • `~top-level閲覧文脈$をいつでも`破棄-$してよい(概して,利用者からの要請に呼応して — 例えば、利用者が,`~top-level閲覧文脈$たちを包含している~window~UIを強制的に閉じたとき)。 ◎ User agents may discard top-level browsing contexts at any time (typically, in response to user requests, e.g. when a user force-closes a window containing one or more top-level browsing contexts).\
  • 他の`閲覧文脈$に対しては、次のときには`破棄-$し~MUST: ◎ Other browsing contexts must be discarded\

    • その`WindowProxy$I ~objが~garbage収集に適格になったとき ◎ once their WindowProxy object is eligible for garbage collection,\
    • この仕様が他所にて破棄するよう要求する所 ◎ in addition to the other places where this specification requires them to be discarded.

`WindowProxy$I ~obj %P は、 %P を伴って作成された`閲覧文脈$への強い参照は持たない。 特に、~JS~codeが %P への参照を保持していても,`入子の閲覧文脈$は`破棄-$され得る。 ◎ A WindowProxy does not have a strong reference to the browsing context it was created alongside. In particular, it is possible for a nested browsing context to be discarded even if JavaScript code holds a reference to its WindowProxy object.

7.3.5. 閲覧文脈を閉じるとき

`閲覧文脈を閉じる@ ときは、所与の ( `閲覧文脈$ %B ) に対し,次を走らす: ◎ To close a browsing context browsingContext, run these steps:

  1. %文書 ~LET %B にて`作動中の文書$ ◎ ↓
  2. `文書の~unloadを~promptする$( %文書 ) ⇒ ~IF[ 利用者は %文書 の`~unloadを拒否-$した ] ⇒ ~RET ◎ Prompt to unload browsingContext's active document. If the user refused to allow the document to be unloaded, then return.
  3. `文書を~unloadする$( %文書 ) ◎ Unload browsingContext's active document with the recycle parameter set to false.
  4. ~UIから %B を除去する (例: ~tab付き~browserにて当の~tabを閉じる/隠すなど。) ◎ Remove browsingContext from the user interface (e.g., close or hide its tab in a tabbed browser).
  5. `閲覧文脈を破棄する$( %B ) ◎ Discard browsingContext.

~UAは、どの`~top-level閲覧文脈$に対しても,利用者が任意に`閲覧文脈を閉じる$能を提供するべきである。 ◎ User agents should offer users the ability to arbitrarily close any top-level browsing context.

7.3.6. ~browser~UI要素

~Web頁を~Web~browserに統合できるようにするため、ある種の~Web~browser~UI要素は,~Web頁~内の~scriptに対し制限された仕方で公開される。 ◎ To allow Web pages to integrate with Web browsers, certain Web browser interface elements are exposed in a limited way to scripts in Web pages.

各~UI要素は、 `BarProp$I ~objにより表現される: ◎ Each interface element is represented by a BarProp object:

[Exposed=Window]
interface `BarProp@I {
  readonly attribute boolean `visible$m;
};
%window . `locationbar$m . `visible$m
%window . `menubar$m . `visible$m
%window . `personalbar$m . `visible$m
%window . `scrollbars$m . `visible$m
%window . `statusbar$m . `visible$m
%window . `toolbar$m . `visible$m
順に,[ location-, menu-, personal-, scroll-, status-, tool- ]bar が[ 可視ならば ~T / 可視でないならば ~F ]を返す。
◎ window . locationbar . visible • Returns true if the location bar is visible; otherwise, returns false. window . menubar . visible • Returns true if the menu bar is visible; otherwise, returns false. window . personalbar . visible • Returns true if the personal bar is visible; otherwise, returns false. window . scrollbars . visible • Returns true if the scroll bars are visible; otherwise, returns false. window . statusbar . visible • Returns true if the status bar is visible; otherwise, returns false. window . toolbar . visible • Returns true if the toolbar is visible; otherwise, returns false.
`visible@m
取得子は、 ~T または,下に述べるように,当の~objが表現する~UI要素の可視性~状態を最も正確aに表現するような,~UAにより決定される値を返さ~MUST。 ◎ The visible attribute, on getting, must return either true or a value determined by the user agent to most accurately represent the visibility state of the user interface element that the object represents, as described below.

以下に挙げる各種 `BarProp$I ~objは、`閲覧文脈$に属する各`文書$に存在する。 これらの~objにより表現される~UI要素のうち一部は、~UAによっては等価なものがないこともある。 そのような~UAであっても、他から指定されない限り,~objは在するかつ可視であるかのように動作し~MUST(すなわち,その `visible$m 属性は ~T を返さ~MUST)。 ◎ The following BarProp objects exist for each Document object in a browsing context. Some of the user interface elements represented by these objects might have no equivalent in some user agents; for those user agents, except when otherwise specified, the object must act as if it was present and visible (i.e. its visible attribute must return true).

`~location-bar@bP ◎ The location bar BarProp object
[ `作動中の文書$の`~URL$を表示する~control ]を包含するような~UI要素に類するものを表現する。 ◎ Represents the user interface element that contains a control that displays the URL of the active document, or some similar interface concept.
`~menu-bar@bP ◎ The menu bar BarProp object
[ ~menu~form内の~commandの~list ]を包含するような~UI要素に類するものを表現する。 ◎ Represents the user interface element that contains a list of commands in menu form, or some similar interface concept.
`~personal-bar@bP ◎ The personal bar BarProp object
[ 利用者の “お気に入り( favorite )” 頁を指す~link ]を包含するような~UI要素に類するものを表現する。 ◎ Represents the user interface element that contains links to the user's favorite pages, or some similar interface concept.
`~scrollbar@bP ◎ The scrollbar BarProp object
[ ~scrollするための仕組み ]を包含するような~UI要素に類するものを表現する。 ◎ Represents the user interface element that contains a scrolling mechanism, or some similar interface concept.
`~status-bar@bP ◎ The status bar BarProp object
利用者の媒体に応じて適切に,文書の直上/直下に見出される~UI要素を表現する。 それは概して,[ 進行中の~network活動や, 利用者の~pointing装置が現在の指示している要素 ]についての情報を供する。 そのような~UI要素を持たない~UAは、~objに対応する~UI要素は不在であったかのように動作してよい(すなわち,その `visible$m 属性は ~F を返してよい)。 ◎ Represents a user interface element found immediately below or after the document, as appropriate for the user's media, which typically provides information about ongoing network activity or information about elements that the user's pointing device is current indicating. If the user agent has no such user interface element, then the object may act as if the corresponding user interface element was absent (i.e. its visible attribute may return false).
`~toolbar@bP ◎ The toolbar BarProp object
利用者の媒体に応じて適切に,文書の直上/直下に見出される~UI要素を表現する。 それは概して,`~session履歴$の走査~control(戻る/進む~button, 再読込み~button, 等々)を供する。 そのような~UI要素を持たない~UAは、~objに対応する~UI要素は不在であったかのように動作してよい(すなわち,その `visible$m 属性は ~F を返してよい)。 ◎ Represents the user interface element found immediately above or before the document, as appropriate for the user's media, which typically provides session history traversal controls (back and forward buttons, reload buttons, etc). If the user agent has no such user interface element, then the object may act as if the corresponding user interface element was absent (i.e. its visible attribute may return false).
`locationbar@m
取得子は、`~location-bar$bPを返さ~MUST。 ◎ The locationbar attribute must return the location bar BarProp object.
`menubar@m
取得子は、`~menu-bar$bPを返さ~MUST。 ◎ The menubar attribute must return the menu bar BarProp object.
`personalbar@m
取得子は、`~personal-bar$bPを返さ~MUST。 ◎ The personalbar attribute must return the personal bar BarProp object.
`scrollbars@m
取得子は、`~scrollbar$bPを返さ~MUST。 ◎ The scrollbars attribute must return the scrollbar BarProp object.
`statusbar@m
取得子は、`~status-bar$bPを返さ~MUST。 ◎ The statusbar attribute must return the status bar BarProp object.
`toolbar@m
取得子は、`~toolbar$bPを返さ~MUST。 ◎ The toolbar attribute must return the toolbar BarProp object.
`status@m
この属性は、歴史的~理由から存在する。 取得子は、最後に設定された文字列を返さ~MUST。 設定子は、自身を新たな値に設定し~MUST。 `~window$の作成-時には、属性は空~文字列に設定され~MUST。 この属性は、他に何もしない。 ◎ For historical reasons, the status attribute on the Window object must, on getting, return the last string it was set to, and on setting, must set itself to the new value. When the Window object is created, the attribute must be set to the empty string. It does not do anything else.

7.3.7. `Window^I ~obj用の~script設定群

~UAは, `~window用に環境~設定群~objを設定しておく@ ことが要求されたときは、所与の ( `~JS実行~文脈$ %実行~文脈, `環境$ %予約-済み環境 (省略時は ε ) ) に対し,次を走らせ~MUST: ◎ When the user agent is required to set up a window environment settings object, given a JavaScript execution context execution context and an optional environment reserved environment, it must run the following steps:

  1. %realm ~LET %実行~文脈 の Realm 成分の値 ◎ Let realm be the value of execution context's Realm component.
  2. %window ~LET %realm の`大域~obj$relem ◎ Let window be realm's global object.
  3. %url ~LET %window に`結付けられている文書$の`~URL$docの複製 ◎ Let url be a copy of the URL of window's associated Document.
  4. %設定群~obj ~LET 各種~algoが次のように定義される,新たな`環境~設定群~obj$ — 以下における %現~文書 とは、~algoが呼出された時点で %window に`結付けられている文書$を表すとする: ◎ Let settings object be a new environment settings object whose algorithms are defined as follows:

    `~realm実行~文脈$enV ◎ The realm execution context
    ~RET %実行~文脈 ◎ Return execution context.
    `~module~map$enV ◎ The module map
    ~RET %現~文書 の`~module~map$doc ◎ Return the module map of window's associated Document.
    `担当の閲覧文脈$enV ◎ The responsible browsing context
    ~RET %window に`対応する閲覧文脈$ ◎ Return the browsing context with which window is associated.
    `担当の~event-loop$enV ◎ The responsible event loop
    ~RET `担当の閲覧文脈$enVが所属している[ `互いに関係するかつ生成元も類似する閲覧文脈~群$ ]に結付けられている`~event-loop$ ◎ Return the event loop that is associated with the unit of related similar-origin browsing contexts to which window's browsing context belongs.
    `担当の文書$enV ◎ The responsible document
    ~RET %現~文書 ◎ Return window's associated Document.
    `~API用~URL文字~符号化法$enV ◎ The API URL character encoding
    ~RET %現~文書 の現在の`文字~符号化法$doc ◎ Return the current character encoding of window's associated Document.
    `~API用~基底~URL$enV ◎ The API base URL
    ~RET %現~文書 の現在の`基底~URL$doc ◎ Return the current base URL of window's associated Document.
    `生成元$enV ◎ The origin
    ~RET %現~文書 の`生成元$ ◎ Return the origin of window's associated Document.
    `~HTTPS状態$enV ◎ The HTTPS state
    ~RET %現~文書 の`~HTTPS状態$doc ◎ Return the HTTPS state of window's associated Document.
    `~referrer施策$enV ◎ The referrer policy
    1. %文書 ~LET %現~文書 ◎ Let document be the Document with which window is currently associated.
    2. ~WHILE[ %文書 は`~iframe-srcdoc文書$である ]~AND[ %文書 の`~referrer施策$doc ~EQ 空~文字列 ] ⇒ %文書 ~SET %文書 が`属する閲覧文脈$の`閲覧文脈~容器$の`~node文書$ ◎ While document is an iframe srcdoc document and document's referrer policy is the empty string, set document to document's browsing context's browsing context container's node document.
    3. ~RET %文書 の`~referrer施策$doc ◎ Return document's referrer policy.
  5. ~IF[ %予約-済み環境 ~NEQ ε ]: ◎ If reserved environment is given, then:

    1. %設定群~obj の ( `~id$enV, `作成時の~URL$enV, `~target閲覧文脈$enV, `作動中の~service-worker$enV ) ~SET %予約-済み環境 の ( それら ) ◎ Set settings object's id to reserved environment's id, settings object's creation URL to reserved environment's creation URL, settings object's target browsing context to reserved environment's target browsing context, and settings object's active service worker to reserved environment's active service worker.
    2. %予約-済み環境 の`~id$enV ~SET 空~文字列 ◎ Set reserved environment's id to the empty string.

      注記: この時点から、 %予約-済み環境 の~id( identity )は %設定群~obj に全部的に転送されたものと見なされ、`環境$の`~id$enVにより探索し得なくなる。 ◎ The identity of the reserved environment is considered to be fully transferred to the created environment settings object. The reserved environment is not searchable by the environment’s id from this point on.

  6. ~ELSE ⇒ %設定群~obj の ⇒# `~id$enV ~SET 新たな一意かつ不透明な文字列, `作成時の~URL$enV ~SET %~url, `~target閲覧文脈$enV ~SET ~NULL, `作動中の~service-worker$enV ~SET ~NULL ◎ Otherwise, set settings object's id to a new unique opaque string, settings object's creation URL to url, settings object's target browsing context to null, and settings object's active service worker to null.
  7. %realm の `HostDefined^sl ~field ~SET %設定群~obj ◎ Set realm's [[HostDefined]] field to settings object.
  8. ~RET %設定群~obj ◎ Return settings object.

7.4. `WindowProxy^I ~exotic~obj

各 `閲覧文脈$ %B には、 `WindowProxy@I ~obj %P が結付けられる。 それは、普通の~objである `Window$I ~obj %W を,次のように包装する~exotic~objである:

【 以下,この節と その各 下位節の内容は、 別ページ にて。 上述は、便宜のため,その冒頭部のみを再掲したものである。 】