Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle incorrect hash/search values in IE6. #3152

Merged
merged 2 commits into from Aug 18, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions backbone.js
Expand Up @@ -1419,7 +1419,12 @@
// Are we at the app root?
atRoot: function() {
var path = this.location.pathname.replace(/[^\/]$/, '$&/');
return path === this.root && !this.location.search;
return path === this.root && !this.getSearch();
},

getSearch: function() {
var match = this.location.href.replace(/#.*$/, '').match(/\?.+$/);
return match ? match[0] : '';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the $ marker here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I think you're right, it's probably not necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 5573ef7.

},

// Gets the true hash value. Cannot use location.hash directly due to bug
Expand All @@ -1431,7 +1436,7 @@

// Get the pathname and search params, without the root.
getPath: function() {
var path = decodeURI(this.location.pathname + this.location.search);
var path = decodeURI(this.location.pathname + this.getSearch());
var root = this.root.slice(0, -1);
if (!path.indexOf(root)) path = path.slice(root.length);
return path.slice(1);
Expand Down