Skip to content

Commit

Permalink
Bugfix: replace hash should not append hash mark to javascript:0
Browse files Browse the repository at this point in the history
It's invalid to do so. Instead it should replace the entire URL,
javascript:0 included.

This gets rid of a javascript error that was emitted in IE7 every time
navigate was used with replace: true
  • Loading branch information
timcharper committed Nov 30, 2011
1 parent e8c1ce7 commit 1a06f9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@
// a new one to the browser history.
_updateHash: function(location, fragment, replace) {
if (replace) {
location.replace(location.toString().replace(/#.*$/, '') + '#' + fragment);
location.replace(location.toString().replace(/(javascript:|#).*$/, "") + "#" + fragment);
} else {
location.hash = fragment;
}
Expand Down

0 comments on commit 1a06f9a

Please sign in to comment.