Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($location/$browser): prevent infinite digests on empty hash changes #9903

Closed

Conversation

petebacondarwin
Copy link
Contributor

Fixes #9635

function getHash(url) {
var index = url.indexOf('#');
return index===-1 ? '' : url.substr(index+1);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess that this function should be inside browser.js but there were other helper function here.

Copy link
Member

Choose a reason for hiding this comment

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

Missing spaces around === and + 😃

@caitp
Copy link
Contributor

caitp commented Nov 4, 2014

this could use some tests --- I think it's probably a suitable place to use the new e2e test harness (since it depends on being able to change location --- you should be able to try changing to about:blank to minimize flakiness)

The url is the same whether or not there is an empty `#` marker at the end.
This prevents unwanted digest turns.

Closes angular#9635
@petebacondarwin
Copy link
Contributor Author

@caitp - yes you are right. I was struggling to test this in an non-artificial way. I'll give it a go tomorrow.
What do you think about the fix in general?

@caitp
Copy link
Contributor

caitp commented Nov 4, 2014

at a glance it looks okay, but $location is a bit complicated, so I want to see it work before I say lgtm

@petebacondarwin
Copy link
Contributor Author

Closing in favour of #9923. @caitp and @tbosch can you take a look at that one?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$location.hash('') causes infinite digest loop
3 participants