-
Notifications
You must be signed in to change notification settings - Fork 4
/
641.txt
98 lines (77 loc) · 3.41 KB
/
641.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
[4] [[フレーム]]を通じて直接の上位にあたる[[閲覧文脈]]のことを、
[DFN[[RUBYB[親閲覧文脈]@en[parent browsing context]]]]といいます。
[DFN[[CODE(JS)@en[window.parent]]]]
は[[親閲覧文脈]]を表す[[オブジェクト]]を返します。
* 仕様書
[REFS[
- [2] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-03-31 07:16:44 +09:00]] 版) <https://html.spec.whatwg.org/#parent-browsing-context>
- [5] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-03-31 07:16:44 +09:00]] 版) <https://html.spec.whatwg.org/#dom-parent>
]REFS]
* 意味
[3] [[閲覧文脈]][VAR[子]]の[DFN[[F[[RUBYB[[[親閲覧文脈]]]@en[parent browsing context]]]]]]は、次のものです
[SRC[>>2]]。
[FIG(steps)[
= [13] [VAR[子]]が[[子供閲覧文脈]]であるような[[閲覧文脈]][VAR[親]]が存在するなら、
== [14] [VAR[親]]
= [15] それ以外なら、
== [16] [CODE[null]]
]FIG]
;; [17] [[親閲覧文脈]]は、高々1つだけ存在します。
;; [19] [[仕様書]]上は、[VAR[親]]が存在しないなら[F[親閲覧文脈]]は存在しません。
* [CODE(DOMi)@en[Window]] インターフェイス [CODE(DOMa)@en[parent]] 属性
[8]
[DFN[[CODE[window.parent]]]]
は、
[[親]]の[[窓]]を返します。
[[最上位閲覧文脈]]の場合、
それ自身の
[CODE[Window]] を返します
(つまり [CODE(JS)[[[window.parent]] === [[window]]]])。
そうでない場合
([CODE[iframe]] など)、
[[親閲覧文脈]]の
[CODE[Window]] を返します。
[6] [CODE(DOMi)@en[Window]] [[インターフェイス]]の
[DFN[[CODE(DOMa)@en[parent]]]] [[IDL属性]]の[[取得器]]は、
次のようにしなければ[MUST[なりません]] [SRC[>>5]]。
[FIG(steps)[
= [25]
[VAR[現在]]を、
[VAR[[[文脈オブジェクト]]]]の[F[閲覧文脈]]に設定します。
= [26]
[VAR[現在]]が [CODE[null]]
の場合、
== [27]
[CODE[null]]
を返します。
= [28]
それ以外で、
[VAR[現在]]が他の[[閲覧文脈]][VAR[親]]の[[子供閲覧文脈]]の場合、
== [29]
[VAR[親]]の
[F[[CODE[WindowProxy]]]]
を返します。
= [30] それ以外の場合、
== [31]
[VAR[現在]]の
[F[[CODE[WindowProxy]]]]
を返します。
]FIG]
[7] この [[IDL属性]]は、 [CODE(xattr IDL)@en[Replaceable]] です [SRC[>>5]]。
* 関連
[12] [[親閲覧文脈]]をたどった先が[[最上位閲覧文脈]]です。
[[最上位閲覧文脈]]は、[F[親閲覧文脈]]が [CODE[null]] の[[閲覧文脈]]です。
[18] [[親閲覧文脈]]の[[推移的閉包]]に属する[[閲覧文脈]]を[[祖先閲覧文脈]]といいます。
* 歴史
[1] [CITE@en[Web Applications 1.0 r8780 Some reference updates, and an example of incumbent vs entry scripts]]
( ([TIME[2014-09-17 14:47:00 +09:00]] 版))
<https://html5.org/r/8780>
[23] [CITE@en[Make Window's parent and top attributes nullable]]
([[yuyokk]]著, [TIME[2016-12-01 06:08:10 +09:00]])
<https://github.com/whatwg/html/commit/9149bbbdeb877f179aef95e4d1cdd418a052886f>
[24] [CITE@en[Editorial: modernize Window's parent and frameElement]]
([[annevk]]著, [TIME[2019-02-22 19:46:09 +09:00]])
<https://github.com/whatwg/html/commit/140fde2fbde648c4d7cb19967a473c7442a0120c>
[9] [CITE@en[Editorial: modernize Window's parent and frameElement by annevk · Pull Request #4380 · whatwg/html]]
([TIME[2019-07-15 20:20:15 +09:00]])
<https://github.com/whatwg/html/pull/4380>