/
506.txt
97 lines (76 loc) · 4.95 KB
/
506.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
[10] [[DOMイベント]]は[[木構造]]に対して定義されていますが、
実際に[[木]]として使われるのは[[節点木]]
([CODE(DOMi)@en[[[Document]]]] や [CODE(DOMi)@en[[[Element]]]] の[[木]]) だけで、
それ以外のほとんどは単一の[[オブジェクト]]です。
* 仕様書
[REFS[
- [19] '''[CITE@en[DOM Standard]] ([TIME[2016-02-18 20:04:25 +09:00]] 版) <https://dom.spec.whatwg.org/#get-the-parent>'''
- [22] [CITE@en[DOM Standard]] ([TIME[2016-02-18 20:04:25 +09:00]] 版) <https://dom.spec.whatwg.org/#node>
- [24] [CITE@en[DOM Standard]] ([TIME[2016-02-18 20:04:25 +09:00]] 版) <https://dom.spec.whatwg.org/#document>
]REFS]
* 親の取得
[16] [CODE(DOMi)@en[[[EventTarget]]]] は、
[[イベント]][VAR[イベント]]を[[引数]]とする[DFN[[RUBYB[親の取得]@en[get the parent]]]][[アルゴリズム]]を持ちます
[SRC[>>19]]。
[21] [[親の取得]]は、特に規定のない場合、常に [[null]] を返します [SRC[>>19]]。
[23] [[節点]][VAR[節点]]の[F[[[親の取得]]]]は、
[VAR[節点]]の[F[[[親]]]]を返します [SRC[>>22]]。
なお[F[[[親]]]]は null かもしれません。
[25] [[文書]][VAR[節点]]の[F[[[親の取得]]]]は、
次のようにします [SRC[>>24]]。
[FIG(steps)[
= [26] [VAR[イベント]]の[F[[[型]]]]が [CODE[[[load]]]] か、
[VAR[文書]]の[F[[[閲覧文脈]]]]が''ない''なら、
== [27] null を返します。
= [28] それ以外なら、
== [29] [VAR[文書]]の[F[[CODE(DOMi)@en[[[Window]]]]]]を返します。
]FIG]
[30] [[親の取得]]は、[[dispatch]] で参照されます。
* 木をまたぐイベントの伝播
[4] [[木]]構造を超えた[[イベント]]の伝播には次のものがあります。
[FIG(list)[
- [5] [CODE(DOMi)@en[[[Document]]]] -> [CODE(DOMi)@en[[[Window]]]] [SRC[>>8]]
- [6] [DEL[[CODE(HTMLe)@en[[[iframe]]]] [CODE(HTMLa)@en[[[seamless]]]] 境界 [SRC[>>11]]]]
-- [[子閲覧文脈]]の [CODE(DOMi)@en[[[Window]]]] の[[親]]が [CODE(DOMi)@en[[[iframe]]]]
- [7] [[影木]]境界 ([[XBL]] / [[Shadow DOM]])
]FIG]
* 歴史
[17] [[dispatch]] において [CODE(DOMi)@en[[[Window]]]] は [CODE(DOMi)@en[[[Document]]]]
の[[親]]として (ほとんどの場合に) 動作するよう昔から実装されていましたが、
[[HTML5]] まで明文化されていませんでした。
[REFS[
-[1] [CITE@en[Bug 18780 – Fix event dispatching for shadow DOM and <iframe seamless>]]
( ([TIME[2013-05-05 14:48:07 +09:00]] 版))
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=18780>
-[2] [CITE[IRC logs: freenode / #whatwg / 20121204]]
( ([TIME[2013-05-05 14:48:23 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20121204#l-1477>
- [11] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2015-05-06 10:42:35 +09:00]] 版) <https://html.spec.whatwg.org/#attr-iframe-seamless>
- [8] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2013-05-05 06:42:10 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#events-and-the-window-object>
]REFS]
[18] [[DOM Standard]] によって[[イベント]]の仕様が再整備されたことで、
[[HTML Standard]] もそれに基づく規定に切り替えられました。
[3] >>1 により [[HTML Standard]] は [[DOM Standard]] より [[event parent]] と
[[cross-boundary event parent]] を引用していますが、現時点で [[DOM Standard]]
に両者の定義はありません。 [TIME[2013-05-05T14:50:19.700Z]]
[HISTORY[
[9] [[閲覧文脈]]中にある [CODE(DOMi)@en[[[Document]]]] に属する[[節点]]において[[イベント]]が[[ディスパッチ]]される時、
[[イベント型]]が [CODE(DOMe)@en[[[load]]]] である時を除き、
[CODE(DOMi)@en[[[Window]]]] が [CODE(DOMi)@en[[[Document]]]] の[[親]]であるように振舞わなければ[['''なりません''']]
[SRC[>>8]]。
]HISTORY]
[13] [CODE(HTMLa)@en[[[seamless]]]] は実装されなかったため2016年2月に削除されました。
[REFS[
- [12] [CITE@en[Remove <iframe seamless> · whatwg/html@1490eba]]
([TIME[2016-02-04 19:17:43 +09:00]] 版)
<https://github.com/whatwg/html/commit/1490eba4dba5ab476f0981443a86c01acae01311>
]REFS]
[20] 2016年2月には[[イベント親]]は[[親の取得]]という形に再編されて、
[[DOM Standard]] に規定が集約されました。
[REFS[
- [14] [CITE@en[Integrate HTML's monkey patch to the event path · whatwg/dom@2d7b637]] ([TIME[2016-02-19 18:05:29 +09:00]] 版) <https://github.com/whatwg/dom/commit/2d7b637b31fc6bad8f6c4743fb61016392fac382>
- [15] [CITE@en[Remove event path monkey patch · whatwg/html@dad854e]] ([TIME[2016-02-19 18:05:36 +09:00]] 版) <https://github.com/whatwg/html/commit/dad854e4c1f5f7098a1b1ec7f33e2218796f7442>
]REFS]
[31] [CITE@en[''''''[''''''Fix #429'''''']'''''' Integrate "get the parent" model for an event path · w3c/webcomponents@0457494]]
([TIME[2016-03-11 15:38:08 +09:00]] 版)
<https://github.com/w3c/webcomponents/commit/0457494032c6668291319df843a7a62faca214c5>