Skip to content

Commit 400b357

Browse files
committed
Changed window['location']['href'] to location.href to fix OMG FUN bug in blackberry 4.6. Closes cowboy#9.
1 parent a62a601 commit 400b357

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

docs/nd/Data/FileInfo.nd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
1.4
22
JavaScript
3-
/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1278343229 1 jQuery hashchange event
4-
/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1278343232 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js
3+
/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1278344463 1 jQuery hashchange event
4+
/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1278344669 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js

jquery.ba-hashchange.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,12 @@
8181
(function($,window,undefined){
8282
'$:nomunge'; // Used by YUI compressor.
8383

84-
// Method / object references.
85-
var fake_onhashchange,
86-
jq_event_special = $.event.special,
84+
// Reused string.
85+
var str_hashchange = 'hashchange',
8786

88-
// Reused strings.
89-
str_location = 'location',
90-
str_hashchange = 'hashchange',
91-
str_href = 'href',
87+
// Method / object references.
88+
fake_onhashchange,
89+
jq_event_special = $.event.special,
9290

9391
// IE6/7 specifically need some special love when it comes to back-button
9492
// support, so let's do a little browser sniffing..
@@ -102,7 +100,7 @@
102100
// Get location.hash (or what you'd expect location.hash to be) sans any
103101
// leading #. Thanks for making this necessary, Firefox!
104102
function get_fragment( url ) {
105-
url = url || window[ str_location ][ str_href ];
103+
url = url || location.href;
106104
return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
107105
};
108106

@@ -227,7 +225,7 @@
227225
$(window).trigger( str_hashchange );
228226

229227
} else if ( history_hash !== last_hash ) {
230-
window[ str_location ][ str_href ] = window[ str_location ][ str_href ].replace( /#.*/, '' ) + history_hash;
228+
location.href = location.href.replace( /#.*/, '' ) + history_hash;
231229
}
232230

233231
timeout_id = setTimeout( poll, $[ str_hashchange + 'Delay' ] );
@@ -274,7 +272,7 @@
274272

275273
// Get history by looking at the hidden Iframe's location.hash.
276274
history_get = function() {
277-
return get_fragment( iframe[ str_location ][ str_href ] );
275+
return get_fragment( iframe.location.href );
278276
};
279277

280278
// Set a new history item by opening and then closing the Iframe
@@ -288,7 +286,7 @@
288286
domain && doc.write( '<script>document.domain="' + domain + '"</script>' );
289287
doc.close();
290288

291-
iframe[ str_location ].hash = hash;
289+
iframe.location.hash = hash;
292290
}
293291
};
294292

jquery.ba-hashchange.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)