Skip to content

Commit 943e915

Browse files
committed
Fixed IE8 "IE7 compatibility" mode regression, renamed jQuery.hashchange* properties to jQuery.fn.hashchange.*, misc cleanup
1 parent f525dae commit 943e915

21 files changed

+161
-105
lines changed

README.markdown

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# jQuery hashchange event #
22
[http://benalman.com/projects/jquery-hashchange-plugin/](http://benalman.com/projects/jquery-hashchange-plugin/)
33

4-
Version: 1.3pre, Last updated: 7/17/2010
4+
Version: 1.3pre, Last updated: 7/20/2010
55

66
This jQuery plugin enables very basic bookmarkable #hash history via a cross-browser window.onhashchange event.
77

@@ -28,7 +28,7 @@ reside (so you can test it yourself).
2828
1.2.6, 1.3.2, 1.4.1, 1.4.2
2929

3030
### Browsers Tested ###
31-
Internet Explorer 6-8, Firefox 2-4, Chrome 3-5, Safari 3-5, Opera 9.6-10.60, iPhone 3.1, Android 2.1, BlackBerry 4.6-5.
31+
Internet Explorer 6-8, Firefox 2-4, Chrome 3-6, Safari 3-5, Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
3232

3333
### Unit Tests ###
3434
[http://benalman.com/code/projects/jquery-hashchange/unit/](http://benalman.com/code/projects/jquery-hashchange/unit/)
@@ -61,7 +61,7 @@ event, but not report that it does, the fallback polling loop will be used.
6161

6262
## Release History ##
6363

64-
1.3pre - (7/17/2010) Reorganized IE6/7 Iframe code to make it more "removable" for mobile development. Added jQuery.hashchangeDomain, jQuery.hashchangeIframeSrc properties and document-domain.html file to address access denied issues when setting document.domain in IE6/7. Note that when using jQuery.hashchangeIframeSrc, history won't be recorded in IE6/7 until the Iframe src file loads. Lowered the default jQuery.hashchangeDelay to 50 milliseconds. Added IE6/7 document.title support. Attempt to make Iframe as hidden as possible by using techniques from http://www.paciellogroup.com/blog/?p=604. Added support for the "shortcut" format $(window).hashchange( fn ) and $(window).hashchange() like jQuery does for built-in events.
64+
1.3pre - (7/20/2010) Reorganized IE6/7 Iframe code to make it more "removable" for mobile-only development. Added IE6/7 document.title support. Attempted to make Iframe as hidden as possible by using techniques from http://www.paciellogroup.com/blog/?p=604. Added support for the "shortcut" format $(window).hashchange( fn ) and $(window).hashchange() like jQuery provides for built-in events. Renamed jQuery.hashchangeDelay to jQuery.fn.hashchange.delay and lowered its default value to 50. Added jQuery.fn.hashchange.domain and jQuery.fn.hashchange.src properties plus document-domain.html file to address access denied issues when setting document.domain in IE6/7.
6565
1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin from a page on another domain would cause an error in Safari 4. Also, IE6/7 Iframe is now inserted after the body (this actually works), which prevents the page from scrolling when the event is first bound. Event can also now be bound before DOM ready, but it won't be usable before then in IE6/7.
6666
1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug where browser version is incorrectly reported as 8.0, despite inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
6767
1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special window.onhashchange functionality into a separate plugin for users who want just the basic event & back button support, without all the extra awesomeness that BBQ provides. This plugin will be included as part of jQuery BBQ, but also be available separately.

docs/files/jquery-ba-hashchange-js.html

+11-11
Large diffs are not rendered by default.

docs/index/Files.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<div id=Index><div class=IPageTitle>File Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; <a href="#J">J</a> &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="J"></a>J</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery_hashchange_event" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>jQuery hashchange event</a></td></tr></table>
1515
<!--START_ND_TOOLTIPS-->
16-
<div class=CToolTip id="tt1"><div class=CFile><b>Version: 1.3pre, Last updated: 7/17/2010</b></div></div><!--END_ND_TOOLTIPS-->
16+
<div class=CToolTip id="tt1"><div class=CFile><b>Version: 1.3pre, Last updated: 7/20/2010</b></div></div><!--END_ND_TOOLTIPS-->
1717

1818
</div><!--Index-->
1919

docs/index/General.html

+11-7
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,33 @@
1111

1212

1313

14-
<div id=Index><div class=IPageTitle>Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; <a href="#E">E</a> &middot; <a href="#F">F</a> &middot; G &middot; <a href="#H">H</a> &middot; I &middot; <a href="#J">J</a> &middot; <a href="#K">K</a> &middot; <a href="#L">L</a> &middot; M &middot; N &middot; O &middot; <a href="#P">P</a> &middot; Q &middot; <a href="#R">R</a> &middot; <a href="#S">S</a> &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="E"></a>E</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Events" class=ISymbol>Events</a></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Examples" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>Examples</a></td></tr><tr><td class=IHeading><a name="F"></a>F</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Functions" class=ISymbol>Functions</a></td></tr><tr><td class=IHeading><a name="H"></a>H</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.fn.hashchange" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')" class=ISymbol>hashchange</a>, <span class=IParent>jQuery.fn</span></td></tr><tr><td class=ISymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#hashchange_event" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')" class=ISymbol>hashchange event</a></td></tr><tr><td class=ISymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')" class=ISymbol>hashchangeDelay</a>, <span class=IParent>jQuery</span></td></tr><tr><td class=ISymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDomain" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')" class=ISymbol>hashchangeDomain</a>, <span class=IParent>jQuery</span></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeIframeSrc" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')" class=ISymbol>hashchangeIframeSrc</a>, <span class=IParent>jQuery</span></td></tr><tr><td class=IHeading><a name="J"></a>J</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery_hashchange_event" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')" class=ISymbol>jQuery hashchange event</a></td></tr><tr><td class=IHeading><a name="K"></a>K</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Known_issues" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')" class=ISymbol>Known issues</a></td></tr><tr><td class=IHeading><a name="L"></a>L</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#License" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')" class=ISymbol>License</a></td></tr><tr><td class=IHeading><a name="P"></a>P</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Properties" class=ISymbol>Properties</a></td></tr><tr><td class=IHeading><a name="R"></a>R</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Release_History" class=ISymbol>Release History</a></td></tr><tr><td class=IHeading><a name="S"></a>S</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Support_and_Testing" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')" class=ISymbol>Support and Testing</a></td></tr></table>
14+
<div id=Index><div class=IPageTitle>Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; <a href="#D">D</a> &middot; <a href="#E">E</a> &middot; <a href="#F">F</a> &middot; G &middot; <a href="#H">H</a> &middot; I &middot; <a href="#J">J</a> &middot; <a href="#K">K</a> &middot; <a href="#L">L</a> &middot; M &middot; N &middot; O &middot; <a href="#P">P</a> &middot; Q &middot; <a href="#R">R</a> &middot; <a href="#S">S</a> &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="D"></a>D</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.fn.hashchange.delay" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>delay</a>, <span class=IParent>jQuery.<wbr>fn.<wbr>hashchange</span></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.fn.hashchange.domain" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')" class=ISymbol>domain</a>, <span class=IParent>jQuery.<wbr>fn.<wbr>hashchange</span></td></tr><tr><td class=IHeading><a name="E"></a>E</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Events" class=ISymbol>Events</a></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Examples" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')" class=ISymbol>Examples</a></td></tr><tr><td class=IHeading><a name="F"></a>F</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Functions" class=ISymbol>Functions</a></td></tr><tr><td class=IHeading><a name="H"></a>H</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.fn.hashchange" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')" class=ISymbol>hashchange</a>, <span class=IParent>jQuery.fn</span></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#hashchange_event" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')" class=ISymbol>hashchange event</a></td></tr><tr><td class=IHeading><a name="J"></a>J</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery_hashchange_event" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')" class=ISymbol>jQuery hashchange event</a></td></tr><tr><td class=IHeading><a name="K"></a>K</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Known_issues" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')" class=ISymbol>Known issues</a></td></tr><tr><td class=IHeading><a name="L"></a>L</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#License" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')" class=ISymbol>License</a></td></tr><tr><td class=IHeading><a name="P"></a>P</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Properties" class=ISymbol>Properties</a></td></tr><tr><td class=IHeading><a name="R"></a>R</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Release_History" class=ISymbol>Release History</a></td></tr><tr><td class=IHeading><a name="S"></a>S</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.fn.hashchange.src" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')" class=ISymbol>src</a>, <span class=IParent>jQuery.<wbr>fn.<wbr>hashchange</span></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Support_and_Testing" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')" class=ISymbol>Support and Testing</a></td></tr></table>
1515
<!--START_ND_TOOLTIPS-->
16-
<div class=CToolTip id="tt1"><div class=CGeneric>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</div></div><!--END_ND_TOOLTIPS-->
16+
<div class=CToolTip id="tt1"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><div class=CToolTip id="tt2"><div class=CProperty>If you&rsquo;re setting document.domain in your JavaScript, and you want hash history to work in IE6/7, not only must this property be set, but you must also set document.domain BEFORE jQuery is loaded into the page. </div></div><!--END_ND_TOOLTIPS-->
17+
18+
19+
<!--START_ND_TOOLTIPS-->
20+
<div class=CToolTip id="tt3"><div class=CGeneric>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</div></div><!--END_ND_TOOLTIPS-->
1721

1822

1923
<!--START_ND_TOOLTIPS-->
2024
<!--END_ND_TOOLTIPS-->
2125

2226

2327
<!--START_ND_TOOLTIPS-->
24-
<div class=CToolTip id="tt2"><div class=CFunction>Bind a handler to the window.onhashchange event or trigger all bound window.onhashchange event handlers. </div></div><div class=CToolTip id="tt3"><div class=CEvent>Fired when location.hash changes. </div></div><div class=CToolTip id="tt4"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><div class=CToolTip id="tt5"><div class=CProperty>If you&rsquo;re setting document.domain in your JavaScript, and you want hash history to work in IE6/7, not only must this property be set, but you must also set document.domain BEFORE jQuery is loaded into the page. </div></div><div class=CToolTip id="tt6"><div class=CProperty>If, for some reason, you need to specify an Iframe src file (for example, when setting document.domain as in jQuery.hashchangeDomain), you can do so using this property. </div></div><!--END_ND_TOOLTIPS-->
28+
<div class=CToolTip id="tt4"><div class=CFunction>Bind a handler to the window.onhashchange event or trigger all bound window.onhashchange event handlers. </div></div><div class=CToolTip id="tt5"><div class=CEvent>Fired when location.hash changes. </div></div><!--END_ND_TOOLTIPS-->
2529

2630

2731
<!--START_ND_TOOLTIPS-->
28-
<div class=CToolTip id="tt7"><div class=CFile><b>Version: 1.3pre, Last updated: 7/17/2010</b></div></div><!--END_ND_TOOLTIPS-->
32+
<div class=CToolTip id="tt6"><div class=CFile><b>Version: 1.3pre, Last updated: 7/20/2010</b></div></div><!--END_ND_TOOLTIPS-->
2933

3034

3135
<!--START_ND_TOOLTIPS-->
32-
<div class=CToolTip id="tt8"><div class=CGeneric>While this jQuery hashchange event implementation is quite stable and robust, there are a few unfortunate browser bugs surrounding expected hashchange event-based behaviors, independent of any JavaScript window.onhashchange abstraction. </div></div><!--END_ND_TOOLTIPS-->
36+
<div class=CToolTip id="tt7"><div class=CGeneric>While this jQuery hashchange event implementation is quite stable and robust, there are a few unfortunate browser bugs surrounding expected hashchange event-based behaviors, independent of any JavaScript window.onhashchange abstraction. </div></div><!--END_ND_TOOLTIPS-->
3337

3438

3539
<!--START_ND_TOOLTIPS-->
36-
<div class=CToolTip id="tt9"><div class=CGeneric>Copyright &copy; 2010 &ldquo;Cowboy&rdquo; Ben Alman, Dual licensed under the MIT and GPL licenses. </div></div><!--END_ND_TOOLTIPS-->
40+
<div class=CToolTip id="tt8"><div class=CGeneric>Copyright &copy; 2010 &ldquo;Cowboy&rdquo; Ben Alman, Dual licensed under the MIT and GPL licenses. </div></div><!--END_ND_TOOLTIPS-->
3741

3842

3943
<!--START_ND_TOOLTIPS-->
@@ -45,7 +49,7 @@
4549

4650

4751
<!--START_ND_TOOLTIPS-->
48-
<div class=CToolTip id="tt10"><div class=CGeneric>Information about what version or versions of jQuery this plugin has been tested with, what browsers it has been tested in, and where the unit tests reside (so you can test it yourself).</div></div><!--END_ND_TOOLTIPS-->
52+
<div class=CToolTip id="tt9"><div class=CProperty>If, for some reason, you need to specify an Iframe src file (for example, when setting document.domain as in jQuery.fn.hashchange.domain), you can do so using this property. </div></div><div class=CToolTip id="tt10"><div class=CGeneric>Information about what version or versions of jQuery this plugin has been tested with, what browsers it has been tested in, and where the unit tests reside (so you can test it yourself).</div></div><!--END_ND_TOOLTIPS-->
4953

5054
</div><!--Index-->
5155

0 commit comments

Comments
 (0)