Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Further modularized IE6/7 code for maximum ease-of-removal for mobile…

… development. Also, slight minification tweaks.
  • Loading branch information...
commit 269e0ed6ec2770ab9e97f48c65011511f1108b3f 1 parent 8da2c03
@cowboy authored
View
6 README.markdown
@@ -1,7 +1,7 @@
# jQuery hashchange event #
[http://benalman.com/projects/jquery-hashchange-plugin/](http://benalman.com/projects/jquery-hashchange-plugin/)
-Version: 1.3pre, Last updated: 7/5/2010
+Version: 1.3pre, Last updated: 7/6/2010
This jQuery plugin enables very basic bookmarkable #hash history via a cross-browser window.onhashchange event.
@@ -27,7 +27,7 @@ reside (so you can test it yourself).
1.2.6, 1.3.2, 1.4.1, 1.4.2
### Browsers Tested ###
-Internet Explorer 6-8, Firefox 2-4, Safari 3-5, Chrome 3-5, Opera 9.6-10.5.
+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.
### Unit Tests ###
[http://benalman.com/code/projects/jquery-hashchange/unit/](http://benalman.com/code/projects/jquery-hashchange/unit/)
@@ -57,7 +57,7 @@ Safari: Back Button from a different domain
## Release History ##
-1.3pre - (7/5/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.
+1.3pre - (7/6/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.
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.
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.
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.
View
6 docs/files/jquery-ba-hashchange-js.html
@@ -11,17 +11,17 @@
-<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="jQuery_hashchange_event"></a>jQuery hashchange event</h1><div class=CBody><p><b>Version: 1.3pre, Last updated: 7/5/2010</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Project Home</td><td class=CDLDescription><a href="http://benalman.com/projects/jquery-hashchange-plugin/" class=LURL target=_top>http://benalman.com<wbr>/projects<wbr>/jquery-hashchange-plugin<wbr>/</a></td></tr><tr><td class=CDLEntry>GitHub</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-hashchange/" class=LURL target=_top>http://github.com/cowboy/jquery-hashchange/</a></td></tr><tr><td class=CDLEntry>Source</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-hashchange<wbr>/raw<wbr>/master<wbr>/jquery.ba-hashchange.js</a></td></tr><tr><td class=CDLEntry>(Minified)</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-hashchange<wbr>/raw<wbr>/master<wbr>/jquery.ba-hashchange.min.js</a> (0.8kb gzipped)</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#jQuery_hashchange_event" >jQuery hashchange event</a></td><td class=SDescription><b>Version: 1.3pre, Last updated: 7/5/2010</b></td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#License" >License</a></td><td class=SDescription>Copyright &copy; 2010 &ldquo;Cowboy&rdquo; Ben Alman, Dual licensed under the MIT and GPL licenses. </td></tr><tr class="SGeneric"><td class=SEntry><a href="#Examples" >Examples</a></td><td class=SDescription>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Support_and_Testing" >Support and Testing</a></td><td class=SDescription>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).</td></tr><tr class="SGeneric"><td class=SEntry><a href="#Known_issues" >Known issues</a></td><td class=SDescription>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. </td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Release_History" >Release History</a></td><td class=SDescription></td></tr><tr class="SGroup"><td class=SEntry><a href="#Properties" >Properties</a></td><td class=SDescription></td></tr><tr class="SProperty SIndent1 SMarked"><td class=SEntry><a href="#jQuery.hashchangeDelay" >jQuery.<wbr>hashchangeDelay</a></td><td class=SDescription>The numeric interval (in milliseconds) at which the <a href="#hashchange_event" class=LEvent id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">hashchange event</a> polling loop executes. </td></tr><tr class="SProperty SIndent1"><td class=SEntry><a href="#jQuery.hashchangeDomain" >jQuery.<wbr>hashchangeDomain</a></td><td class=SDescription>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.</td></tr><tr class="SProperty SIndent1 SMarked"><td class=SEntry><a href="#jQuery.hashchangeIframeSrc" >jQuery.<wbr>hashchangeIframeSrc</a></td><td class=SDescription>If, for some reason, you need to specify an Iframe src file (for example, when setting document.domain as in <a href="#jQuery.hashchangeDomain" class=LProperty id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">jQuery.hashchangeDomain</a>), you can do so using this property.</td></tr><tr class="SGroup"><td class=SEntry><a href="#Events" >Events</a></td><td class=SDescription></td></tr><tr class="SEvent SIndent1 SMarked"><td class=SEntry><a href="#hashchange_event" >hashchange event</a></td><td class=SDescription>Fired when location.hash changes. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
+<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="jQuery_hashchange_event"></a>jQuery hashchange event</h1><div class=CBody><p><b>Version: 1.3pre, Last updated: 7/6/2010</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Project Home</td><td class=CDLDescription><a href="http://benalman.com/projects/jquery-hashchange-plugin/" class=LURL target=_top>http://benalman.com<wbr>/projects<wbr>/jquery-hashchange-plugin<wbr>/</a></td></tr><tr><td class=CDLEntry>GitHub</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-hashchange/" class=LURL target=_top>http://github.com/cowboy/jquery-hashchange/</a></td></tr><tr><td class=CDLEntry>Source</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-hashchange<wbr>/raw<wbr>/master<wbr>/jquery.ba-hashchange.js</a></td></tr><tr><td class=CDLEntry>(Minified)</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-hashchange<wbr>/raw<wbr>/master<wbr>/jquery.ba-hashchange.min.js</a> (0.8kb gzipped)</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#jQuery_hashchange_event" >jQuery hashchange event</a></td><td class=SDescription><b>Version: 1.3pre, Last updated: 7/6/2010</b></td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#License" >License</a></td><td class=SDescription>Copyright &copy; 2010 &ldquo;Cowboy&rdquo; Ben Alman, Dual licensed under the MIT and GPL licenses. </td></tr><tr class="SGeneric"><td class=SEntry><a href="#Examples" >Examples</a></td><td class=SDescription>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Support_and_Testing" >Support and Testing</a></td><td class=SDescription>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).</td></tr><tr class="SGeneric"><td class=SEntry><a href="#Known_issues" >Known issues</a></td><td class=SDescription>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. </td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Release_History" >Release History</a></td><td class=SDescription></td></tr><tr class="SGroup"><td class=SEntry><a href="#Properties" >Properties</a></td><td class=SDescription></td></tr><tr class="SProperty SIndent1 SMarked"><td class=SEntry><a href="#jQuery.hashchangeDelay" >jQuery.<wbr>hashchangeDelay</a></td><td class=SDescription>The numeric interval (in milliseconds) at which the <a href="#hashchange_event" class=LEvent id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">hashchange event</a> polling loop executes. </td></tr><tr class="SProperty SIndent1"><td class=SEntry><a href="#jQuery.hashchangeDomain" >jQuery.<wbr>hashchangeDomain</a></td><td class=SDescription>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.</td></tr><tr class="SProperty SIndent1 SMarked"><td class=SEntry><a href="#jQuery.hashchangeIframeSrc" >jQuery.<wbr>hashchangeIframeSrc</a></td><td class=SDescription>If, for some reason, you need to specify an Iframe src file (for example, when setting document.domain as in <a href="#jQuery.hashchangeDomain" class=LProperty id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">jQuery.hashchangeDomain</a>), you can do so using this property.</td></tr><tr class="SGroup"><td class=SEntry><a href="#Events" >Events</a></td><td class=SDescription></td></tr><tr class="SEvent SIndent1 SMarked"><td class=SEntry><a href="#hashchange_event" >hashchange event</a></td><td class=SDescription>Fired when location.hash changes. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="License"></a>License</h3><div class=CBody><p>Copyright &copy; 2010 &ldquo;Cowboy&rdquo; Ben Alman, Dual licensed under the MIT and GPL licenses.&nbsp; <a href="http://benalman.com/about/license/" class=LURL target=_top>http://benalman.com/about/license/</a></p></div></div></div>
<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Examples"></a>Examples</h3><div class=CBody><p>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>hashchange event</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/examples<wbr>/hashchange<wbr>/</a></td></tr><tr><td class=CDLEntry>document.domain</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/examples<wbr>/document_domain<wbr>/</a></td></tr></table></div></div></div>
-<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Support_and_Testing"></a>Support and Testing</h3><div class=CBody><p>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).</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>jQuery Versions</td><td class=CDLDescription>1.2.6, 1.3.2, 1.4.1, 1.4.2</td></tr><tr><td class=CDLEntry>Browsers Tested</td><td class=CDLDescription>Internet Explorer 6-8, Firefox 2-4, Safari 3-5, Chrome 3-5, Opera 9.6-10.5.</td></tr><tr><td class=CDLEntry>Unit Tests</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/unit/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/unit<wbr>/</a></td></tr></table></div></div></div>
+<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Support_and_Testing"></a>Support and Testing</h3><div class=CBody><p>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).</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>jQuery Versions</td><td class=CDLDescription>1.2.6, 1.3.2, 1.4.1, 1.4.2</td></tr><tr><td class=CDLEntry>Browsers Tested</td><td class=CDLDescription>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.</td></tr><tr><td class=CDLEntry>Unit Tests</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/unit/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/unit<wbr>/</a></td></tr></table></div></div></div>
<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Known_issues"></a>Known issues</h3><div class=CBody><p>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.&nbsp; See the following examples for more information:</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Chrome: Back Button</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/examples<wbr>/bug-chrome-back-button<wbr>/</a></td></tr><tr><td class=CDLEntry>Firefox: Remote XMLHttpRequest</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/examples<wbr>/bug-firefox-remote-xhr<wbr>/</a></td></tr><tr><td class=CDLEntry>WebKit: Back Button in an Iframe</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/examples<wbr>/bug-webkit-hash-iframe<wbr>/</a></td></tr><tr><td class=CDLEntry>Safari: Back Button from a different domain</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-hashchange<wbr>/examples<wbr>/bug-safari-back-from-diff-domain<wbr>/</a></td></tr></table></div></div></div>
-<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Release_History"></a>Release History</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>1.3pre</td><td class=CDLDescription>(7/5/2010) Reorganized IE6/7 Iframe code to make it more &ldquo;removable&rdquo; for mobile development.&nbsp; Added <a href="#jQuery.hashchangeDomain" class=LProperty id=link3 onMouseOver="ShowTip(event, 'tt2', 'link3')" onMouseOut="HideTip('tt2')">jQuery.hashchangeDomain</a>, <a href="#jQuery.hashchangeIframeSrc" class=LProperty id=link4 onMouseOver="ShowTip(event, 'tt3', 'link4')" onMouseOut="HideTip('tt3')">jQuery.hashchangeIframeSrc</a> properties and document-domain.html file to address access denied issues when setting document.domain in IE6/7.&nbsp; Note that when using <a href="#jQuery.hashchangeIframeSrc" class=LProperty id=link5 onMouseOver="ShowTip(event, 'tt3', 'link5')" onMouseOut="HideTip('tt3')">jQuery.hashchangeIframeSrc</a>, history won&rsquo;t be recorded in IE6/7 until the Iframe src file loads.&nbsp; Lowered the default <a href="#jQuery.hashchangeDelay" class=LProperty id=link6 onMouseOver="ShowTip(event, 'tt4', 'link6')" onMouseOut="HideTip('tt4')">jQuery.hashchangeDelay</a> to 50 milliseconds.&nbsp; Added IE6/7 document.title support.&nbsp; Attempt to make Iframe as hidden as possible by using techniques from <a href="http://www.paciellogroup.com/blog/?p=604" class=LURL target=_top>http://www.paciellogroup.com/blog/?p=604</a>.</td></tr><tr><td class=CDLEntry>1.2</td><td class=CDLDescription>(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.&nbsp; 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.&nbsp; Event can also now be bound before DOM ready, but it won&rsquo;t be usable before then in IE6/7.</td></tr><tr><td class=CDLEntry>1.1</td><td class=CDLDescription>(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.</td></tr><tr><td class=CDLEntry>1.0</td><td class=CDLDescription>(1/9/2010) Initial Release.&nbsp; Broke out the jQuery BBQ event.special window.onhashchange functionality into a separate plugin for users who want just the basic event &amp; back button support, without all the extra awesomeness that BBQ provides.&nbsp; This plugin will be included as part of jQuery BBQ, but also be available separately.</td></tr></table></div></div></div>
+<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Release_History"></a>Release History</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>1.3pre</td><td class=CDLDescription>(7/6/2010) Reorganized IE6/7 Iframe code to make it more &ldquo;removable&rdquo; for mobile development.&nbsp; Added <a href="#jQuery.hashchangeDomain" class=LProperty id=link3 onMouseOver="ShowTip(event, 'tt2', 'link3')" onMouseOut="HideTip('tt2')">jQuery.hashchangeDomain</a>, <a href="#jQuery.hashchangeIframeSrc" class=LProperty id=link4 onMouseOver="ShowTip(event, 'tt3', 'link4')" onMouseOut="HideTip('tt3')">jQuery.hashchangeIframeSrc</a> properties and document-domain.html file to address access denied issues when setting document.domain in IE6/7.&nbsp; Note that when using <a href="#jQuery.hashchangeIframeSrc" class=LProperty id=link5 onMouseOver="ShowTip(event, 'tt3', 'link5')" onMouseOut="HideTip('tt3')">jQuery.hashchangeIframeSrc</a>, history won&rsquo;t be recorded in IE6/7 until the Iframe src file loads.&nbsp; Lowered the default <a href="#jQuery.hashchangeDelay" class=LProperty id=link6 onMouseOver="ShowTip(event, 'tt4', 'link6')" onMouseOut="HideTip('tt4')">jQuery.hashchangeDelay</a> to 50 milliseconds.&nbsp; Added IE6/7 document.title support.&nbsp; Attempt to make Iframe as hidden as possible by using techniques from <a href="http://www.paciellogroup.com/blog/?p=604" class=LURL target=_top>http://www.paciellogroup.com/blog/?p=604</a>.</td></tr><tr><td class=CDLEntry>1.2</td><td class=CDLDescription>(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.&nbsp; 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.&nbsp; Event can also now be bound before DOM ready, but it won&rsquo;t be usable before then in IE6/7.</td></tr><tr><td class=CDLEntry>1.1</td><td class=CDLDescription>(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.</td></tr><tr><td class=CDLEntry>1.0</td><td class=CDLDescription>(1/9/2010) Initial Release.&nbsp; Broke out the jQuery BBQ event.special window.onhashchange functionality into a separate plugin for users who want just the basic event &amp; back button support, without all the extra awesomeness that BBQ provides.&nbsp; This plugin will be included as part of jQuery BBQ, but also be available separately.</td></tr></table></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Properties"></a>Properties</h3></div></div>
View
2  docs/index/Files.html
@@ -13,7 +13,7 @@
<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>
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt1"><div class=CFile><b>Version: 1.3pre, Last updated: 7/5/2010</b></div></div><!--END_ND_TOOLTIPS-->
+<div class=CToolTip id="tt1"><div class=CFile><b>Version: 1.3pre, Last updated: 7/6/2010</b></div></div><!--END_ND_TOOLTIPS-->
</div><!--Index-->
View
2  docs/index/General.html
@@ -21,7 +21,7 @@
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt6"><div class=CFile><b>Version: 1.3pre, Last updated: 7/5/2010</b></div></div><!--END_ND_TOOLTIPS-->
+<div class=CToolTip id="tt6"><div class=CFile><b>Version: 1.3pre, Last updated: 7/6/2010</b></div></div><!--END_ND_TOOLTIPS-->
<!--START_ND_TOOLTIPS-->
View
4 docs/nd/Data/FileInfo.nd
@@ -1,4 +1,4 @@
1.4
JavaScript
-/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1278369175 1 jQuery hashchange event
-/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1278369180 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js
+/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1278468263 1 jQuery hashchange event
+/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1278468471 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js
View
BIN  docs/nd/Data/SymbolTable.nd
Binary file not shown
View
49 jquery.ba-hashchange.js
@@ -1,5 +1,5 @@
/*!
- * jQuery hashchange event - v1.3pre - 7/5/2010
+ * jQuery hashchange event - v1.3pre - 7/6/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
@@ -9,7 +9,7 @@
// Script: jQuery hashchange event
//
-// *Version: 1.3pre, Last updated: 7/5/2010*
+// *Version: 1.3pre, Last updated: 7/6/2010*
//
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
// GitHub - http://github.com/cowboy/jquery-hashchange/
@@ -37,7 +37,8 @@
// reside (so you can test it yourself).
//
// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
-// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Safari 3-5, Chrome 3-5, Opera 9.6-10.5.
+// Browsers Tested - 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.
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
//
// About: Known issues
@@ -54,7 +55,7 @@
//
// About: Release History
//
-// 1.3pre - (7/5/2010) Reorganized IE6/7 Iframe code to make it more
+// 1.3pre - (7/6/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
@@ -85,17 +86,15 @@
var str_hashchange = 'hashchange',
// Method / object references.
+ doc = document,
fake_onhashchange,
jq_event_special = $.event.special,
- // IE6/7 specifically need some special love when it comes to back-button
- // support, so let's do a little browser sniffing..
- browser = $.browser,
- mode = document.documentMode,
- is_old_ie = browser.msie && ( mode === undefined || mode < 8 ),
-
- // Does the browser support window.onhashchange?
- supports_onhashchange = 'on' + str_hashchange in window && ( mode === undefined || mode > 7 );
+ // Does the browser support window.onhashchange? Note that IE8 running in
+ // IE7 compatibility mode reports true for 'onhashchange' in window, even
+ // though the event isn't supported, so also test document.documentMode.
+ doc_mode = doc.documentMode,
+ supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
// Get location.hash (or what you'd expect location.hash to be) sans any
// leading #. Thanks for making this necessary, Firefox!
@@ -234,12 +233,16 @@
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7 vvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
- //
- // In IE 6/7, create a hidden Iframe for history handling.
- is_old_ie && (function(){
- var iframe,
+ (function(){
+ var browser = $.browser,
+ iframe,
iframe_src;
+ // If browser isn't IE 6/7, abort!! ABORT!!!
+ if ( !browser.msie || browser.version > 7 ) { return; }
+
+ // When the event is bound and polling starts in IE 6/7, create a hidden
+ // Iframe for history handling.
self.start = function(){
if ( !iframe ) {
iframe_src = $[ str_hashchange + 'IframeSrc' ];
@@ -267,10 +270,10 @@
// prettify the back/next history menu entries. Since IE sometimes
// errors with "Unspecified error" the very first time this is set
// (yes, very useful) wrap this with a try/catch block.
- document.onpropertychange = function(){
+ doc.onpropertychange = function(){
try {
if ( event.propertyName === 'title' ) {
- iframe.document.title = document.title;
+ iframe.document.title = doc.title;
}
} catch(e) {}
};
@@ -292,18 +295,18 @@
// document, *then* setting its location.hash. If document.domain has
// been set, update that as well.
history_set = function( hash, history_hash ) {
- var doc = iframe.document,
+ var iframe_doc = iframe.document,
domain = $[ str_hashchange + 'Domain' ];
if ( hash !== history_hash ) {
// Update Iframe with any initial `document.title` that might be set.
- doc.title = document.title;
+ iframe_doc.title = doc.title;
// Opening the Iframe's document after it has been closed is what
// actually adds a history entry.
- doc.open();
- domain && doc.write( '<script>document.domain="' + domain + '"</script>' );
- doc.close();
+ iframe_doc.open();
+ domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
+ iframe_doc.close();
// Update the Iframe's hash, for great justice.
iframe.location.hash = hash;
View
4 jquery.ba-hashchange.min.js
@@ -1,9 +1,9 @@
/*
- * jQuery hashchange event - v1.3pre - 7/5/2010
+ * jQuery hashchange event - v1.3pre - 7/6/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
-(function($,h,b){var c="hashchange",i,j=$.event.special,e=$.browser,f=document.documentMode,g=e.msie&&(f===b||f<8),d="on"+c in h&&(f===b||f>7);function a(k){k=k||location.href;return"#"+k.replace(/^[^#]*#?(.*)$/,"$1")}$[c+"Delay"]=50;j[c]=$.extend(j[c],{setup:function(){if(d){return false}$(i.start)},teardown:function(){if(d){return false}$(i.stop)}});i=(function(){var k={},q,n=a(),l=function(r){return r},m=l,p=l;k.start=function(){q||o()};k.stop=function(){q&&clearTimeout(q);q=b};function o(){var s=a(),r=p(n);if(s!==n){m(n=s,r);$(h).trigger(c)}else{if(r!==n){location.href=location.href.replace(/#.*/,"")+r}}q=setTimeout(o,$[c+"Delay"])}g&&(function(){var r,s;k.start=function(){if(!r){s=$[c+"IframeSrc"];s=s&&s+a();r=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){s||m(a());o()}).attr("src",s||"javascript:0").insertAfter("body")[0].contentWindow;document.onpropertychange=function(){try{if(event.propertyName==="title"){r.document.title=document.title}}catch(t){}}}};k.stop=l;p=function(){return a(r.location.href)};m=function(w,t){var v=r.document,u=$[c+"Domain"];if(w!==t){v.title=document.title;v.open();u&&v.write('<script>document.domain="'+u+'"<\/script>');v.close();r.location.hash=w}}})();return k})()})(jQuery,this);
+(function($,e,b){var c="hashchange",g=document,f,h=$.event.special,i=g.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$[c+"Delay"]=50;h[c]=$.extend(h[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$[c+"Delay"])}(function(){var q=$.browser,r,s;if(!q.msie||q.version>7){return}j.start=function(){if(!r){s=$[c+"IframeSrc"];s=s&&s+a();r=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){s||l(a());n()}).attr("src",s||"javascript:0").insertAfter("body")[0].contentWindow;g.onpropertychange=function(){try{if(event.propertyName==="title"){r.document.title=g.title}}catch(t){}}}};j.stop=k;o=function(){return a(r.location.href)};l=function(w,t){var v=r.document,u=$[c+"Domain"];if(w!==t){v.title=g.title;v.open();u&&v.write('<script>document.domain="'+u+'"<\/script>');v.close();r.location.hash=w}}})();return j})()})(jQuery,this);
Please sign in to comment.
Something went wrong with that request. Please try again.