Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reorganized IE6/7 Iframe code to make it more removable (for mobile d…

…ev) and added support for document.domain in IE6/7 via jQuery.hashchangeDomain and jQuery.hashchangeIframeSrc properties. Lowered default jQuery.hashchangeDelay value to 50 milliseconds. This commit fixed issue #5.
  • Loading branch information...
commit c164cce3978fcf0ead8f52f954c7dd9c7a9e43ae 1 parent 2ec65fc
@cowboy authored
View
5 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.2, Last updated: 2/11/2010
+Version: 1.3pre, Last updated: 7/5/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-3.7, Safari 3-4, Chrome, Opera 9.6-10.1.
+Internet Explorer 6-8, Firefox 2-3.7, Safari 3-5, Chrome 3-5, Opera 9.6-10.5.
### Unit Tests ###
[http://benalman.com/code/projects/jquery-hashchange/unit/](http://benalman.com/code/projects/jquery-hashchange/unit/)
@@ -57,6 +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 dev) and added support for document.domain in IE6/7 via jQuery.hashchangeDomain and jQuery.hashchangeIframeSrc properties. 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.
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
20 docs/files/jquery-ba-hashchange-js.html
@@ -11,28 +11,32 @@
-<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.2, Last updated: 2/11/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> (1.1kb)</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.2, Last updated: 2/11/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>This working example, complete with fully commented code, illustrate one way 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="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/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> (1.3kb)</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 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>This working example, complete with fully commented code, illustrate one way 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></table></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-3.7, Safari 3-4, Chrome, Opera 9.6-10.1.</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-3.7, 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="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.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/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.</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>
-<div class="CProperty"><div class=CTopic><h3 class=CTitle><a name="jQuery.hashchangeDelay"></a>jQuery.<wbr>hashchangeDelay</h3><div class=CBody><p>The numeric interval (in milliseconds) at which the <a href="#hashchange_event" class=LEvent id=link2 onMouseOver="ShowTip(event, 'tt1', 'link2')" onMouseOut="HideTip('tt1')">hashchange event</a> polling loop executes.&nbsp; Defaults to 100.</p></div></div></div>
+<div class="CProperty"><div class=CTopic><h3 class=CTitle><a name="jQuery.hashchangeDelay"></a>jQuery.<wbr>hashchangeDelay</h3><div class=CBody><p>The numeric interval (in milliseconds) at which the <a href="#hashchange_event" class=LEvent id=link7 onMouseOver="ShowTip(event, 'tt1', 'link7')" onMouseOut="HideTip('tt1')">hashchange event</a> polling loop executes.&nbsp; Defaults to 50.</p></div></div></div>
+
+<div class="CProperty"><div class=CTopic><h3 class=CTitle><a name="jQuery.hashchangeDomain"></a>jQuery.<wbr>hashchangeDomain</h3><div class=CBody><p>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.</p><p>In addition, the <a href="#jQuery.hashchangeIframeSrc" class=LProperty id=link8 onMouseOver="ShowTip(event, 'tt3', 'link8')" onMouseOut="HideTip('tt3')">jQuery.hashchangeIframeSrc</a> property must be set to the path of the included &ldquo;document-domain.html&rdquo; file, which can be renamed or modified if necessary (note that the document.domain specified must be the same in both your main JavaScript as well as in this file).</p><h4 class=CHeading>Usage</h4><p>$.hashchangeDomain = document.domain;</p></div></div></div>
+
+<div class="CProperty"><div class=CTopic><h3 class=CTitle><a name="jQuery.hashchangeIframeSrc"></a>jQuery.<wbr>hashchangeIframeSrc</h3><div class=CBody><p>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=link9 onMouseOver="ShowTip(event, 'tt2', 'link9')" onMouseOut="HideTip('tt2')">jQuery.hashchangeDomain</a>), you can do so using this property.</p><h4 class=CHeading>Usage</h4><p>$.hashchangeIframeSrc = &lsquo;path/to/file.html&rsquo;;</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Events"></a>Events</h3></div></div>
-<div class="CEvent"><div class=CTopic><h3 class=CTitle><a name="hashchange_event"></a>hashchange event</h3><div class=CBody><p>Fired when location.hash changes.&nbsp; In browsers that support it, the native window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is initialized, running every <a href="#jQuery.hashchangeDelay" class=LProperty id=link3 onMouseOver="ShowTip(event, 'tt2', 'link3')" onMouseOut="HideTip('tt2')">jQuery.hashchangeDelay</a> milliseconds to see if the hash has changed.&nbsp; In IE 6 and 7, a hidden Iframe is created to allow the back button and hash-based history to work.</p><h4 class=CHeading>Usage</h4><blockquote><pre>$(window).bind( 'hashchange', function(e) {
+<div class="CEvent"><div class=CTopic><h3 class=CTitle><a name="hashchange_event"></a>hashchange event</h3><div class=CBody><p>Fired when location.hash changes.&nbsp; In browsers that support it, the native HTML5 window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is initialized, running every <a href="#jQuery.hashchangeDelay" class=LProperty id=link10 onMouseOver="ShowTip(event, 'tt4', 'link10')" onMouseOut="HideTip('tt4')">jQuery.hashchangeDelay</a> milliseconds to see if the hash has changed.&nbsp; In IE 6 and 7, a hidden Iframe is created to allow the back button and hash-based history to work.</p><h4 class=CHeading>Usage</h4><blockquote><pre>$(window).bind( 'hashchange', function(e) {
var hash = location.hash;
...
-});</pre></blockquote><h4 class=CHeading>Additional Notes</h4><ul><li>The polling loop and Iframe are not created until at least one callback is actually bound to &lsquo;hashchange&rsquo;.</li><li>If you need the bound callback(s) to execute immediately, in cases where the page &lsquo;state&rsquo; exists on page load (via bookmark or page refresh, for example) use $(window).trigger( &lsquo;hashchange&rsquo; );</li><li>The event can be bound before DOM ready, but since it won&rsquo;t be usable before then in IE6/7 (due to the necessary Iframe), recommended usage is to bind it inside a $(document).ready() callback.</li></ul></div></div></div>
+});</pre></blockquote><h4 class=CHeading>Additional Notes</h4><ul><li>The polling loop and Iframe are not created until at least one callback is actually bound to &lsquo;hashchange&rsquo;.</li><li>If you need the bound callback(s) to execute immediately, in cases where the page &lsquo;state&rsquo; exists on page load (via bookmark or page refresh, for example) use $(window).trigger( &lsquo;hashchange&rsquo; );</li><li>The event can be bound before DOM ready, but since it won&rsquo;t be usable before then in IE6/7 (due to the necessary Iframe), recommended usage is to bind it inside a DOM ready callback.</li></ul></div></div></div>
</div><!--Content-->
@@ -47,7 +51,7 @@
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt1"><div class=CEvent>Fired when location.hash changes. </div></div><div class=CToolTip id="tt2"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><!--END_ND_TOOLTIPS-->
+<div class=CToolTip id="tt1"><div class=CEvent>Fired when location.hash changes. </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><div class=CToolTip id="tt3"><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><div class=CToolTip id="tt4"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><!--END_ND_TOOLTIPS-->
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.2, Last updated: 2/11/2010</b></div></div><!--END_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><!--Index-->
View
14 docs/index/General.html
@@ -11,25 +11,25 @@
-<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; F &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="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#hashchange_event" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')" class=ISymbol>hashchange event</a></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')" class=ISymbol>hashchangeDelay</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=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')" 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=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')" 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=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')" 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=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')" class=ISymbol>Support and Testing</a></td></tr></table>
+<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; F &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="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#hashchange_event" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')" 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=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')" 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=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')" 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=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')" 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=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=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#Support_and_Testing" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')" class=ISymbol>Support and Testing</a></td></tr></table>
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt1"><div class=CGeneric>This working example, complete with fully commented code, illustrate one way in which this plugin can be used.</div></div><!--END_ND_TOOLTIPS-->
+<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-->
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt2"><div class=CEvent>Fired when location.hash changes. </div></div><div class=CToolTip id="tt3"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><!--END_ND_TOOLTIPS-->
+<div class=CToolTip id="tt2"><div class=CEvent>Fired when location.hash changes. </div></div><div class=CToolTip id="tt3"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><div class=CToolTip id="tt4"><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="tt5"><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-->
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt4"><div class=CFile><b>Version: 1.2, Last updated: 2/11/2010</b></div></div><!--END_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-->
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt5"><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-->
+<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-->
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt6"><div class=CGeneric>Copyright &copy; 2010 &ldquo;Cowboy&rdquo; Ben Alman, Dual licensed under the MIT and GPL licenses. </div></div><!--END_ND_TOOLTIPS-->
+<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-->
<!--START_ND_TOOLTIPS-->
@@ -41,7 +41,7 @@
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt7"><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-->
+<div class=CToolTip id="tt9"><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-->
</div><!--Index-->
View
4 docs/index/Properties.html
@@ -11,9 +11,9 @@
-<div id=Index><div class=IPageTitle>Property Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; <a href="#H">H</a> &middot; I &middot; J &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="H"></a>H</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>hashchangeDelay</a>, <span class=IParent>jQuery</span></td></tr></table>
+<div id=Index><div class=IPageTitle>Property Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; <a href="#H">H</a> &middot; I &middot; J &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="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.hashchangeDelay" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" 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=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')" 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=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')" class=ISymbol>hashchangeIframeSrc</a>, <span class=IParent>jQuery</span></td></tr></table>
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt1"><div class=CProperty>The numeric interval (in milliseconds) at which the hashchange event polling loop executes. </div></div><!--END_ND_TOOLTIPS-->
+<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><div class=CToolTip id="tt3"><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-->
</div><!--Index-->
View
BIN  docs/nd/Data/ConfigFileInfo.nd
Binary file not shown
View
4 docs/nd/Data/FileInfo.nd
@@ -1,4 +1,4 @@
1.4
JavaScript
-/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1268400937 1 jQuery hashchange event
-/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1268400955 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js
+/srv/projects/jquery-hashchange-domain/jquery.ba-hashchange.js 1278342314 1 jQuery hashchange event
+/srv/projects/jquery-hashchange-domain/jquery.ba-hashchange.min.js 1278342372 0 /srv/projects/jquery-hashchange-domain/jquery.ba-hashchange.min.js
View
BIN  docs/nd/Data/PreviousMenuState.nd
Binary file not shown
View
BIN  docs/nd/Data/PreviousSettings.nd
Binary file not shown
View
BIN  docs/nd/Data/SymbolTable.nd
Binary file not shown
View
2  docs/search/GeneralH.html
@@ -11,7 +11,7 @@
-<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_hashchange_spcevent><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#hashchange_event" target=_parent class=ISymbol>hashchange event</a></div></div><div class=SRResult id=SR_hashchangeDelay><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" target=_parent class=ISymbol>hashchangeDelay</a>, <span class=IParent>jQuery</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
+<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_hashchange_spcevent><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#hashchange_event" target=_parent class=ISymbol>hashchange event</a></div></div><div class=SRResult id=SR_hashchangeDelay><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" target=_parent class=ISymbol>hashchangeDelay</a>, <span class=IParent>jQuery</span></div></div><div class=SRResult id=SR_hashchangeDomain><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDomain" target=_parent class=ISymbol>hashchangeDomain</a>, <span class=IParent>jQuery</span></div></div><div class=SRResult id=SR_hashchangeIframeSrc><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeIframeSrc" target=_parent class=ISymbol>hashchangeIframeSrc</a>, <span class=IParent>jQuery</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");
View
2  docs/search/PropertiesH.html
@@ -11,7 +11,7 @@
-<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_hashchangeDelay><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" target=_parent class=ISymbol>hashchangeDelay</a>, <span class=IParent>jQuery</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
+<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_hashchangeDelay><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDelay" target=_parent class=ISymbol>hashchangeDelay</a>, <span class=IParent>jQuery</span></div></div><div class=SRResult id=SR_hashchangeDomain><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeDomain" target=_parent class=ISymbol>hashchangeDomain</a>, <span class=IParent>jQuery</span></div></div><div class=SRResult id=SR_hashchangeIframeSrc><div class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.hashchangeIframeSrc" target=_parent class=ISymbol>hashchangeIframeSrc</a>, <span class=IParent>jQuery</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");
View
4 document-domain.html
@@ -0,0 +1,4 @@
+<html><script>
+ // Modify as needed. For example, replace -2 with -3 for .co.uk domains.
+ document.domain = document.domain.split('.').slice(-2).join('.');
+</script></html>
View
169 examples/document_domain/index.php
@@ -0,0 +1,169 @@
+<?PHP
+
+include "../index.php";
+
+$shell['title3'] = "document.domain";
+
+$shell['h2'] = 'The hash, it\'s a-changin\'...';
+
+// ========================================================================== //
+// SCRIPT
+// ========================================================================== //
+
+ob_start();
+?>
+$(function(){
+
+ // These two properties, set after jQuery and the hashchange event plugin are
+ // loaded, only need to be used when document.domain is set (to fix the "access
+ // denied" error in IE6/7).
+ $.hashchangeIframeSrc = '../../document-domain.html';
+ $.hashchangeDomain = document.domain;
+
+ // Bind an event to window.onhashchange that, when the hash changes, gets the
+ // hash and adds the class "selected" to any matching nav link.
+ $(window).bind( 'hashchange', function(){
+ var hash = location.hash;
+
+ // Iterate over all nav links, setting the "selected" class as-appropriate.
+ $('#nav a').each(function(){
+ var that = $(this);
+ that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'selected' );
+ });
+ })
+
+ // Since the event is only triggered when the hash changes, we need to trigger
+ // the event now, to handle the hash the page may have loaded with.
+ $(window).trigger( 'hashchange' );
+
+});
+<?
+$shell['script'] = ob_get_contents();
+ob_end_clean();
+
+// ========================================================================== //
+// HTML HEAD ADDITIONAL
+// ========================================================================== //
+
+ob_start();
+?>
+<script type="text/javascript">
+ // If setting document.domain, be sure to do it *before* jQuery is loaded!
+ document.domain = document.domain.split('.').slice(-2).join('.');
+</script>
+<?
+$shell['html_head_pre'] = ob_get_contents();
+ob_end_clean();
+
+ob_start();
+?>
+<script type="text/javascript" src="../../jquery.ba-hashchange.js"></script>
+<script type="text/javascript" language="javascript">
+
+<?= $shell['script']; ?>
+
+$(function(){
+
+ // Syntax highlighter.
+ SyntaxHighlighter.highlight();
+
+});
+
+</script>
+<style type="text/css" title="text/css">
+
+/*
+bg: #FDEBDC
+bg1: #FFD6AF
+bg2: #FFAB59
+orange: #FF7F00
+brown: #913D00
+lt. brown: #C4884F
+*/
+
+#page {
+ width: 700px;
+}
+
+#nav {
+ font-size: 200%;
+}
+
+#nav a {
+ color: #777;
+ border: 2px solid #777;
+ background-color: #ccc;
+ padding: 0.2em 0.6em;
+ text-decoration: none;
+ float: left;
+ margin-right: 0.3em;
+}
+
+#nav a:hover {
+ color: #999;
+ border-color: #999;
+ background: #eee;
+}
+
+#nav a.selected,
+#nav a.selected:hover {
+ color: #0a0;
+ border-color: #0a0;
+ background: #afa;
+}
+
+</style>
+<?
+$shell['html_head'] = ob_get_contents();
+ob_end_clean();
+
+// ========================================================================== //
+// HTML BODY
+// ========================================================================== //
+
+ob_start();
+?>
+<?= $shell['donate'] ?>
+
+<p>
+ <a href="http://benalman.com/projects/jquery-hashchange-plugin/">jQuery hashchange event</a> enables very basic bookmarkable #hash history via a cross-browser window.onhashchange event. <em>This example is exactly like the basic <a href="../hashchange/">hashchange event example</a> except that document.domain is set, and the example code has been modifed accordingly.</em>
+</p>
+
+<h3>Click, and watch as the magic happens!</h3>
+
+<p id="nav">
+ <a href="#test1">test 1</a>
+ <a href="#test2">test 2</a>
+ <a href="#test3">test 3</a>
+ <a href="#test4">test 4</a>
+</p>
+
+<div class="clear" style="padding-top:1em;"></div>
+
+<p>
+ Note that there is absolutely no JavaScript attached to the click event of these links. All they do is set the <code>location.hash</code> via href, and the callback bound to the window.onhashchange event does the rest. Once you've clicked one or more of these links, fool around with your browser's back and next buttons.
+</p>
+
+<h3>The code</h3>
+
+<pre class="brush:js">
+<?= htmlspecialchars( $shell['script'] ); ?>
+</pre>
+
+<h3>That's it!</h3>
+
+<p>
+ This plugin is, by design, very basic. If you want to add lot of extra utility around getting and setting the hash as a state, and parsing and merging fragment params, check out the <a href="http://benalman.com/projects/jquery-bbq-plugin/">jQuery BBQ</a> plugin. It includes this plugin at its core, plus a whole lot more, and has thorough documentation and examples as well. You can't have too much of a good thing!
+</p>
+
+<?
+$shell['html_body'] = ob_get_contents();
+ob_end_clean();
+
+// ========================================================================== //
+// DRAW SHELL
+// ========================================================================== //
+
+draw_shell();
+
+?>
View
3  examples/index.php
@@ -32,6 +32,9 @@ function draw_shell() {
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Ben Alman &raquo; <?= $shell['title1'] ?><? if ( $shell['title2'] ) { print ' &raquo; ' . $shell['title2']; } ?><? if ( $shell['title3'] ) { print ' &raquo; ' . $shell['title3']; } ?></title>
+
+ <?= $shell['html_head_pre'] ?>
+
<script type="text/javascript" src="<?= $base ?>../shared/ba-debug.js"></script>
<?
if ( $shell['jquery'] ) {
View
216 jquery.ba-hashchange.js
@@ -1,5 +1,5 @@
/*!
- * jQuery hashchange event - v1.2 - 2/11/2010
+ * jQuery hashchange event - v1.3pre - 7/5/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
@@ -9,12 +9,12 @@
// Script: jQuery hashchange event
//
-// *Version: 1.2, Last updated: 2/11/2010*
+// *Version: 1.3pre, Last updated: 7/5/2010*
//
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
// GitHub - http://github.com/cowboy/jquery-hashchange/
// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
-// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (1.1kb)
+// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (1.3kb)
//
// About: License
//
@@ -24,10 +24,11 @@
//
// About: Examples
//
-// This working example, complete with fully commented code, illustrate one way
-// in which this plugin can be used.
+// These working examples, complete with fully commented code, illustrate a few
+// ways in which this plugin can be used.
//
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
+// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
//
// About: Support and Testing
//
@@ -36,7 +37,7 @@
// 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-3.7, Safari 3-4, Chrome, Opera 9.6-10.1.
+// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-5, Chrome 3-5, Opera 9.6-10.5.
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
//
// About: Known issues
@@ -53,6 +54,13 @@
//
// About: 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.
// 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),
@@ -86,31 +94,55 @@
mode = document.documentMode,
is_old_ie = browser.msie && ( mode === undefined || mode < 8 ),
- // Does the browser support window.onhashchange? Test for IE version, since
- // IE8 incorrectly reports this when in "IE7" or "IE8 Compatibility View"!
- supports_onhashchange = 'on' + str_hashchange in window && !is_old_ie;
+ // Does the browser support window.onhashchange?
+ supports_onhashchange = 'on' + str_hashchange in window && ( mode === undefined || mode > 7 );
// Get location.hash (or what you'd expect location.hash to be) sans any
// leading #. Thanks for making this necessary, Firefox!
function get_fragment( url ) {
url = url || window[ str_location ][ str_href ];
- return url.replace( /^[^#]*#?(.*)$/, '$1' );
+ return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
};
// Property: jQuery.hashchangeDelay
//
// The numeric interval (in milliseconds) at which the <hashchange event>
- // polling loop executes. Defaults to 100.
+ // polling loop executes. Defaults to 50.
- $[ str_hashchange + 'Delay' ] = 100;
+ $[ str_hashchange + 'Delay' ] = 50;
+
+ // Property: jQuery.hashchangeDomain
+ //
+ // If you'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.
+ //
+ // In addition, the <jQuery.hashchangeIframeSrc> property must be set to the
+ // path of the included "document-domain.html" file, which can be renamed or
+ // modified if necessary (note that the document.domain specified must be the
+ // same in both your main JavaScript as well as in this file).
+ //
+ // Usage:
+ //
+ // $.hashchangeDomain = document.domain;
+
+ // Property: jQuery.hashchangeIframeSrc
+ //
+ // 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.
+ //
+ // Usage:
+ //
+ // $.hashchangeIframeSrc = 'path/to/file.html';
// Event: hashchange event
//
// Fired when location.hash changes. In browsers that support it, the native
- // window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is
- // initialized, running every <jQuery.hashchangeDelay> milliseconds to see if
- // the hash has changed. In IE 6 and 7, a hidden Iframe is created to allow
- // the back button and hash-based history to work.
+ // HTML5 window.onhashchange event is used (IE8, FF3.6), otherwise a polling
+ // loop is initialized, running every <jQuery.hashchangeDelay> milliseconds
+ // to see if the hash has changed. In IE 6 and 7, a hidden Iframe is created
+ // to allow the back button and hash-based history to work.
//
// Usage:
//
@@ -128,7 +160,7 @@
// example) use $(window).trigger( 'hashchange' );
// * The event can be bound before DOM ready, but since it won't be usable
// before then in IE6/7 (due to the necessary Iframe), recommended usage is
- // to bind it inside a $(document).ready() callback.
+ // to bind it inside a DOM ready callback.
jq_event_special[ str_hashchange ] = $.extend( jq_event_special[ str_hashchange ], {
@@ -161,82 +193,106 @@
fake_onhashchange = (function(){
var self = {},
timeout_id,
- iframe,
- set_history,
- get_history;
+
+ // Remember the initial hash so it doesn't get triggered immediately.
+ last_hash = get_fragment(),
+
+ fn_retval = function(val){ return val; },
+ history_set = fn_retval,
+ history_get = fn_retval;
+
+ // Start the polling loop.
+ self.start = function() {
+ timeout_id || poll();
+ };
+
+ // Stop the polling loop.
+ self.stop = function() {
+ timeout_id && clearTimeout( timeout_id );
+ timeout_id = undefined;
+ };
- // Initialize. In IE 6/7, creates a hidden Iframe for history handling.
- function init(){
- // Most browsers don't need special methods here..
- set_history = get_history = function(val){ return val; };
+ // This polling loop checks every $.hashchangeDelay milliseconds to see if
+ // location.hash has changed, and triggers the 'hashchange' event on
+ // window when necessary.
+ function poll() {
+ var hash = get_fragment(),
+ history_hash = history_get( last_hash );
- // But IE6/7 do!
- if ( is_old_ie ) {
-
- // Create hidden Iframe after the end of the body to prevent initial
- // page load from scrolling unnecessarily.
- iframe = $('<iframe src="javascript:0"/>').hide().insertAfter( 'body' )[0].contentWindow;
+ if ( hash !== last_hash ) {
+ history_set( last_hash = hash, history_hash );
- // Get history by looking at the hidden Iframe's location.hash.
- get_history = function() {
- return get_fragment( iframe.document[ str_location ][ str_href ] );
- };
+ $(window).trigger( str_hashchange );
- // Set a new history item by opening and then closing the Iframe
- // document, *then* setting its location.hash.
- set_history = function( hash, history_hash ) {
- if ( hash !== history_hash ) {
- var doc = iframe.document;
- doc.open().close();
- doc[ str_location ].hash = '#' + hash;
- }
- };
-
- // Set initial history.
- set_history( get_fragment() );
+ } else if ( history_hash !== last_hash ) {
+ window[ str_location ][ str_href ] = window[ str_location ][ str_href ].replace( /#.*/, '' ) + history_hash;
}
+
+ timeout_id = setTimeout( poll, $[ str_hashchange + 'Delay' ] );
};
- // Start the polling loop.
- self.start = function() {
- // Polling loop is already running!
- if ( timeout_id ) { return; }
+ // 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,
+ iframe_src;
- // Remember the initial hash so it doesn't get triggered immediately.
- var last_hash = get_fragment();
+ self.start = function(){
+ if ( !iframe ) {
+ iframe_src = $[ str_hashchange + 'IframeSrc' ];
+ iframe_src = iframe_src && iframe_src + get_fragment();
+
+ // Create hidden Iframe.
+ iframe = $('<iframe/>').hide()
+
+ // When Iframe has completely loaded, initialize the history and
+ // start polling.
+ .one( 'load', function(){
+ iframe_src || history_set( get_fragment() );
+ poll();
+ })
+
+ // Load Iframe src if specified, otherwise nothing.
+ .attr( 'src', iframe_src || 'javascript:0' )
+
+ // Append Iframe after the end of the body to prevent unnecessary
+ // initial page scrolling (yes, this works).
+ .insertAfter( 'body' )[0].contentWindow;
+ }
+ };
- // Initialize if not yet initialized.
- set_history || init();
+ // Override the "stop" method since an IE6/7 Iframe was created. Even
+ // if there are no longer any bound event handlers, the polling loop
+ // is still necessary for back/next to work at all!
+ self.stop = fn_retval;
- // This polling loop checks every $.hashchangeDelay milliseconds to see if
- // location.hash has changed, and triggers the 'hashchange' event on
- // window when necessary.
- (function loopy(){
- var hash = get_fragment(),
- history_hash = get_history( last_hash );
-
- if ( hash !== last_hash ) {
- set_history( last_hash = hash, history_hash );
+ // Get history by looking at the hidden Iframe's location.hash.
+ history_get = function() {
+ return get_fragment( iframe[ str_location ][ str_href ] );
+ };
+
+ // Set a new history item by opening and then closing the Iframe
+ // document, *then* setting its location.hash. If document.domain has
+ // been set, update that as well.
+ history_set = function( hash, history_hash ) {
+ if ( hash !== history_hash ) {
+ var doc = iframe.document.open(),
+ domain = $[ str_hashchange + 'Domain' ];
- $(window).trigger( str_hashchange );
+ domain && doc.write( '<script>document.domain="' + domain + '"</script>' );
+ doc.close();
- } else if ( history_hash !== last_hash ) {
- window[ str_location ][ str_href ] = window[ str_location ][ str_href ].replace( /#.*/, '' ) + '#' + history_hash;
+ iframe[ str_location ].hash = hash;
}
-
- timeout_id = setTimeout( loopy, $[ str_hashchange + 'Delay' ] );
- })();
- };
-
- // Stop the polling loop, but only if an IE6/7 Iframe wasn't created. In
- // that case, even if there are no longer any bound event handlers, the
- // polling loop is still necessary for back/next to work at all!
- self.stop = function() {
- if ( !iframe ) {
- timeout_id && clearTimeout( timeout_id );
- timeout_id = 0;
- }
- };
+ };
+
+ })();
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7 ^^^^^^^^^^^^^^^^^^^
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return self;
})();
View
4 jquery.ba-hashchange.min.js
@@ -1,9 +1,9 @@
/*
- * jQuery hashchange event - v1.2 - 2/11/2010
+ * jQuery hashchange event - v1.3pre - 7/5/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($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
+(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&(g===b||g>7);function a(m){m=m||i[c][l];return"#"+m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=50;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},s,p=a(),n=function(t){return t},o=n,r=n;m.start=function(){s||q()};m.stop=function(){s&&clearTimeout(s);s=b};function q(){var u=a(),t=r(p);if(u!==p){o(p=u,t);$(i).trigger(d)}else{if(t!==p){i[c][l]=i[c][l].replace(/#.*/,"")+t}}s=setTimeout(q,$[d+"Delay"])}h&&(function(){var t,u;m.start=function(){if(!t){u=$[d+"IframeSrc"];u=u&&u+a();t=$("<iframe/>").hide().one("load",function(){u||o(a());q()}).attr("src",u||"javascript:0").insertAfter("body")[0].contentWindow}};m.stop=n;r=function(){return a(t[c][l])};o=function(y,v){if(y!==v){var x=t.document.open(),w=$[d+"Domain"];w&&x.write('<script>document.domain="'+w+'"<\/script>');x.close();t[c].hash=y}}})();return m})()})(jQuery,this);
View
38 unit/document-domain.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery hashchange event - Unit Tests</title>
+ <link rel="stylesheet" href="qunit.css" type="text/css" media="screen">
+ <script type="text/javascript">
+ document.domain = document.domain.split('.').slice(-2).join('.');
+ var document_domain_set = true;
+ </script>
+ <script type="text/javascript" src="../shared/qunit.js"></script>
+
+ <script type="text/javascript" src="../shared/jquery-1.4.2.js"></script>
+
+ <script type="text/javascript" src="../jquery.ba-hashchange.js"></script>
+ <script type="text/javascript" src="unit.js"></script>
+</head>
+<body>
+ <div id="qunit-header">
+ <h1>jQuery hashchange event - Unit Tests</h1>
+ <small><a href="http://benalman.com/projects/jquery-hashchange-plugin/">Project Home</a></small>
+ <div style="clear:both"></div>
+ </div>
+ <h2 id="qunit-banner"><span></span></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <p>
+ <i>These unit tests include jQuery <span id="jq_version">...</span>.</i>
+ <br>To view the unit tests using jQuery 1.4.2, <a href="./">click here</a>.
+ <br>To view the unit tests using jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
+ <br>To view a unit test page using &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; <a href="./ie7-compat.html">click here</a> (IE8).
+ <br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>. <b>(selected)</b>
+ </p>
+ <ol id="qunit-tests"></ol>
+ <div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
+</body>
+</html>
View
12 unit/ie7-compat.html
@@ -21,11 +21,13 @@ <h2 id="qunit-banner"><span></span></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<p>
- These unit tests include jQuery <span id="jq_version">...</span>. To view the unit tests using
- jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>, to view the unit tests using
- jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>, and to view the unit tests using
- jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
- <br><i>This page uses &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; (IE8).</i>
+ <i>These unit tests include jQuery <span id="jq_version">...</span>.</i>
+ <br>To view the unit tests using jQuery 1.4.2, <a href="./">click here</a>.
+ <br>To view the unit tests using jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
+ <br>To view a unit test page using &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; <a href="./ie7-compat.html">click here</a> (IE8). <b>(selected)</b>
+ <br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
View
10 unit/index.html
@@ -20,11 +20,13 @@ <h2 id="qunit-banner"><span></span></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<p>
- These unit tests include jQuery <span id="jq_version">...</span>. To view the unit tests using
- jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>, to view the unit tests using
- jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>, and to view the unit tests using
- jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
+ <i>These unit tests include jQuery <span id="jq_version">...</span>.</i>
+ <br>To view the unit tests using jQuery 1.4.2, <a href="./">click here</a>. <b>(selected)</b>
+ <br>To view the unit tests using jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
<br>To view a unit test page using &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; <a href="./ie7-compat.html">click here</a> (IE8).
+ <br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
View
10 unit/jquery-1.2.6.html
@@ -20,11 +20,13 @@ <h2 id="qunit-banner"><span></span></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<p>
- These unit tests include jQuery <span id="jq_version">...</span>. To view the unit tests using
- jQuery 1.4.2, <a href="./">click here</a>, to view the unit tests using
- jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>, and to view the unit tests using
- jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>.
+ <i>These unit tests include jQuery <span id="jq_version">...</span>.</i>
+ <br>To view the unit tests using jQuery 1.4.2, <a href="./">click here</a>.
+ <br>To view the unit tests using jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>. <b>(selected)</b>
<br>To view a unit test page using &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; <a href="./ie7-compat.html">click here</a> (IE8).
+ <br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
View
10 unit/jquery-1.3.2.html
@@ -20,11 +20,13 @@ <h2 id="qunit-banner"><span></span></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<p>
- These unit tests include jQuery <span id="jq_version">...</span>. To view the unit tests using
- jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>, to view the unit tests using
- jQuery 1.4.2, <a href="./">click here</a>, and to view the unit tests using
- jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>.
+ <i>These unit tests include jQuery <span id="jq_version">...</span>.</i>
+ <br>To view the unit tests using jQuery 1.4.2, <a href="./">click here</a>.
+ <br>To view the unit tests using jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>. <b>(selected)</b>
+ <br>To view the unit tests using jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
<br>To view a unit test page using &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; <a href="./ie7-compat.html">click here</a> (IE8).
+ <br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
View
10 unit/jquery-1.4.1.html
@@ -20,11 +20,13 @@ <h2 id="qunit-banner"><span></span></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<p>
- These unit tests include jQuery <span id="jq_version">...</span>. To view the unit tests using
- jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>, to view the unit tests using
- jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>, and to view the unit tests using
- jQuery 1.4.2, <a href="./">click here</a>.
+ <i>These unit tests include jQuery <span id="jq_version">...</span>.</i>
+ <br>To view the unit tests using jQuery 1.4.2, <a href="./">click here</a>.
+ <br>To view the unit tests using jQuery 1.4.1, <a href="./jquery-1.4.1.html">click here</a>. <b>(selected)</b>
+ <br>To view the unit tests using jQuery 1.3.2, <a href="./jquery-1.3.2.html">click here</a>.
+ <br>To view the unit tests using jQuery 1.2.6, <a href="./jquery-1.2.6.html">click here</a>.
<br>To view a unit test page using &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; <a href="./ie7-compat.html">click here</a> (IE8).
+ <br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
View
8 unit/unit.js
@@ -54,19 +54,23 @@ function run_many_tests() {
var hash;
-// Pulled out of the plugin
+// Pulled out of the plugin, pretty much.
function get_fragment( url ) {
url = url || location.href;
return url.replace( /^[^#]*#?(.*)$/, '$1' );
};
+if ( window.document_domain_set ) {
+ $.hashchangeIframeSrc = '../document-domain.html';
+ $.hashchangeDomain = document.domain;
+}
+
// Event can be bound before DOM ready.
$(window).bind( 'hashchange', function(e) {
hash = get_fragment();
});
$(function(){
-
$('#jq_version').html( $.fn.jquery );
module( 'jQuery hashchange event' );
Please sign in to comment.
Something went wrong with that request. Please try again.