* 仕様書

[REFS[
- [41] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2015-04-25 04:40:19 +09:00]] 版) <https://html.spec.whatwg.org/#hashchangeevent>
]REFS]

* [CODE(DOMe)@en[hashchange]] イベント

[5] [DFN[[CODE(DOMe)@en[[[hashchange]]]]]] [[イベント]]は、表示中の[[文書の番地]]の[[素片識別子]]が変更された時、
[[発火]]されます。

[6] [[履歴の探索]]が発生した時に、必要なら [CODE(DOMi)@en[[[Window]]]]
[[オブジェクト]]で[[発火]]されます。

;; [7] [[navigate]] により新しい[[文書]]を表示した時には[[発火]]しません。

;; [8] [[発火]]は、[[文書の番地]]の変更後に行われます。

* [CODE(DOMi)@en[HashChangeEvent]] インターフェイス

[42] [DFN[[CODE(DOMi)@en[[[HashChangeEvent]]]]]] [[インターフェイス]] [SRC[>>41]] は、
[CODE(DOMe)@en[[[hashchange]]]] [[イベント]]と共に用いられます。
[[文書環境]][DEL[と[[ワーカー環境]]]]に[[晒され]]ています [SRC[>>41]]。

[44] [CODE(DOMi)@en[[[HashChangeEvent]]]] [[インターフェイス]]は、
他の [CODE(DOMi)@en[[[Event]]]] [[インターフェイス]]同様の[[コンストラクター]]を持ちます
[SRC[>>41]]。
初期化のための辞書は [DFN[[CODE(DOMi)@en[[[HashChangeEventInit]]]]]] です [SRC[>>41]]。

[43] [CODE(DOMi)@en[[[HashChangeEvent]]]] [[インターフェイス]]は、
[CODE(DOMi)@en[[[Event]]]] [[インターフェイス]]を[[継承]]しています [SRC[>>41]]。
[CODE(DOMi)@en[[[HashChangeEventInit]]]] [[辞書]]は、
[CODE(DOMi)@en[[[EventInit]]]] [[辞書]]を[[継承]]しています [SRC[>>41]]。

[45] [CODE(DOMi)@en[[[HashChangeEvent]]]] [[インターフェイス]]および
[CODE(DOMi)@en[[[HashChangeEventInit]]]] [[辞書]]は、[CODE(IDL)@en[USVString]]
型の読み取り専用[[IDL属性]] [DFN[[CODE(DOMa)@en[[[oldURL]]]]]],
[DFN[[CODE(DOMa)@en[[[newURL]]]]]] 
(共に[[既定値]]は[[空文字列]]) を持ちます [SRC[>>41]]。
[[履歴の探索]]で [CODE(DOMe)@en[[[hashchange]]]]
[[イベント]]が[[発火]]される時は、元の [[URL]] と新しい [[URL]]
が設定されます。どちらも[[素片識別子]]以外は同じはずです。

* 歴史

[3] [CITE[Re: several messages about an event for when the #fragid	changes]] ([[Ian Hickson <ian@...>]] 著, [TIME[2007-08-10 01:26:42 +09:00]] 版) <http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/11644>

[1] [CITE[クロスブラウザな onhashchange イベント (作りかけ) - Yet Another Hackadelic]] ([TIME[2009-02-01 19:36:17 +09:00]] 版) <http://d.hatena.ne.jp/ZIGOROu/20081205/1228465473>

[2] [CITE@en-us[Firefox 3.6 for developers - MDC]]
([TIME[2009-09-17 19:24:08 +09:00]] 版)
<https://developer.mozilla.org/en/Firefox_3.6_for_developers#DOM>

[9] [CITE@en[Editorial: define Event attribute defaults through IDL · whatwg/html@0be0229]]
([TIME[2016-03-23 21:15:34 +09:00]] 版)
<https://github.com/whatwg/html/commit/0be02299f128cbb7c65a7ce259fdd838fd44a4b5>

[10] [CITE@en[Use USVString for oldURL, newURL, and origin attributes on events · whatwg/html@5d5702d]]
([TIME[2016-03-23 21:19:59 +09:00]] 版)
<https://github.com/whatwg/html/commit/5d5702d35a0b7457481d1013154f14aab25500bf>

[11] [CITE@en[Make HashChangeEvent members default to the empty string]]
( ([[annevk]]著, [TIME[2016-05-05 01:34:22 +09:00]]))
<https://github.com/whatwg/html/commit/cf02812b16c7eee9ac9943b4abec14c0f26b248f>

[4] [CITE@en['''['''''']''' (0) Let's try adding an event that fires when you change just the …]]
( ([[Hixie]]著, [TIME[2007-08-10 10:12:53 +09:00]]))
<https://github.com/whatwg/html/commit/6efa630d6498f2f525e9a182a6f5381dbed62a70>

[12] [CITE@en['''['''e''']''' (0) Clear up the navigate-fragid section (nothing important chang…]]
( ([[Hixie]]著, [TIME[2007-08-10 10:29:18 +09:00]]))
<https://github.com/whatwg/html/commit/56e00f08166d9af357727d6fb3c2184c4f569daa>

[13] [CITE@en['''['''i''']''' (2) Mute hashchanged until after the load event has fired, to avo…]]
( ([[Hixie]]著, [TIME[2009-01-16 07:11:55 +09:00]]))
<https://github.com/whatwg/html/commit/589d7d3bd880f1f487418c6ed7583fed03d6344b>

[14] [CITE@en[PopStateEvent/HashChangeEvent/PageTransitionEvent are Window-only]]
([[zcorpan]]著, [TIME[2016-09-13 21:25:40 +09:00]])
<https://github.com/whatwg/html/commit/dec1a5809e15d29592a66147ce2bed5018121b5f>

[15] [CITE@en[Make popstate and hashchange events not bubble]]
([[foolip]]著, [TIME[2018-06-07 21:23:33 +09:00]])
<https://github.com/whatwg/html/commit/85e1e724cf09574dba47d5eae689bdb5b7fd6502>

[16] [CITE@en[Let the popstate and hashchange events not bubble by foolip · Pull Request #3737 · whatwg/html]]
([TIME[2018-06-08 14:38:07 +09:00]])
<https://github.com/whatwg/html/pull/3737>