/
388.txt
108 lines (72 loc) · 4.48 KB
/
388.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
99
100
101
102
103
104
105
106
107
108
* 仕様書
[REFS[
- [17] [CITE@en[Page Visibility]] ([TIME[2013-05-20 14:33:13 +09:00]] 版) <https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#pv-unloaded>
]REFS]
* 文書を unload
@@ [DFN[unload a document]] -> [[unloading document visibility change steps]]
* onunload 属性 (HTML, XHTML 1)
@@ この章は古いです
[1] [[HTML]] の [CODE(HTMLe)[[[body]]]] 要素と
[CODE(HTMLe)[[[frameset]]]] 要素の [DFN[[CODE(HTMLa)[onunload]] 属性]]は、
[[UA]] が[[窓]]または[[フレーム]]から[[文書]]を除去する時に発生する[[事象]]に関する[[内在事象]]属性です。
[2] 仕様書:
- [[HTML 4]]
-- [CODE(HTMLa)[onunload]] 属性
<IW:HTML4:"interact/scripts.html#adef-onunload">
[[#comment]]
** 代替
[3] 内在事象属性は[[表現と構造の分離]]の原則に反するので、
好ましくないと考える人もいます。また、 [[DOM 0]]
に基づく古い設計です。
代わりに、 [CODE(HTMLe)[[[script]]]] 要素などにより関連付けたスクリプト内で
[[DOM 2]] 以上の[[事象]]に関するメソッド等が利用できます。
DOM 水準2 や DOM 水準 3 の HTML 事象モジュールはこの属性に対応する
DOM の事象 [CODE(DOM)[[[unload]]]] を用意しています。
[[#comment]]
** 属性値
[4] この属性の値は [CODE(SGML)[%[[Script]]]] です。 [[SGML]]
的には [CODE(SGML)[[[CDATA]]]] です。[[スクリプト言語]]は、
[CODE(HTTP)[[[Content-Script-Type]]]] によります。
[5] この属性は省略可能です。
[[#comment]]
** 他との関係
[6] この属性に対応する DOM の事象は [CODE(DOM)[[[load]]]]
です。そちらもあわせてごらんください。
[7] 反対の意味の [CODE(HTMLa)[[[onload]]]] 属性もあります。
* [CODE(DOMa)@en[visibilityState]] 属性の値 [CODE(DOM)@en[unloaded]] (DOM)
[16] [CODE(DOMi)@en[[[Document]]]] [[オブジェクト]]の [CODE(DOMa)@en[[[visibilityState]]]]
[[属性]]は、[[最上位閲覧文脈]]に含まれている [CODE(DOMi)@en[[[Document]]]] が[[unload]]の過程にある時は、
[DFN[[CODE(DOM)@en[[[unloaded]]]]]] を返す[['''べきです''']]。 [SRC[>>17]]
;; [18] [CODE(DOM)@en[[[unloaded]]]] という値には対応しなくても構わない [SRC[>>17]] とされています。
;; [19] [CODE(JS)@en[[[document.hidden]]]] は[[偽]]になります。
* メモ
[8] [CITE@en[(X)HTML5 Tracking]]
([TIME[2009-10-12 14:36:54 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4104&to=4105>
[9] [CITE[Surfin’ Safari - Blog Archive » WebKit Page Cache II – The unload Event]]
([TIME[2009-10-25 15:54:55 +09:00]] 版)
<http://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/>
[10] [CITE[''''''[''''''whatwg'''''']'''''' Declarative unload data]]
( ([TIME[2012-05-08 08:28:55 +09:00]] 版))
<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/035686.html>
[11] [CITE[''''''[''''''whatwg'''''']'''''' Declarative unload data]]
( ([TIME[2012-05-08 08:29:21 +09:00]] 版))
<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/035706.html>
[12] [CITE[Issue 113605 - chromium - Fire event unload, onbeforeunload, pagehide - An open-source browser project to help move the web forward. - Google Project Hosting]]
([TIME[2012-05-11 17:14:26 +09:00]] 版)
<http://code.google.com/p/chromium/issues/detail?id=113605#c2>
[13] [CITE@en[Web Applications 1.0 r7318 Allow script termination dialogs to close the page too.]]
( ([TIME[2012-09-06 01:48:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7317&to=7318>
[14] [CITE[''''''[''''''whatwg'''''']'''''' Declarative unload data]]
( ([TIME[2012-11-21 02:05:52 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-November/038040.html>
[15] [CITE[''''''[''''''whatwg'''''']'''''' events when navigating away before page load?]]
( ([TIME[2012-12-15 06:00:01 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-December/038344.html>
[20] [CITE@en[Web Applications 1.0 r8609 align 'load' and 'unload' events since they have similar quirks in practice]]
( ([TIME[2014-05-07 07:16:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8608&to=8609>
[21] [CITE[Part2 - browsersec - Browser Security Handbook, part 2 - Browser Security Handbook - Google Project Hosting]]
([TIME[2015-03-31 16:49:11 +09:00]] 版)
<https://code.google.com/p/browsersec/wiki/Part2#Page_transition_logic>