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

Commit e8f9dd7

Browse files
author
Pavel Vasek
committed
If you use html5mode on IE9, IE8 it fails with 10 $digest() iterations reached.
There was an issue with location.replace method isn't changing the location.href immediately.
1 parent 5b592cb commit e8f9dd7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ng/browser.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ function Browser(window, document, $log, $sniffer) {
123123
// URL API
124124
//////////////////////////////////////////////////////////////
125125

126-
var lastBrowserUrl = location.href,
127-
baseElement = document.find('base');
126+
var lastBrowserUrl = location.href,
127+
baseElement = document.find('base'),
128+
replacedUrl = null;
128129

129130
/**
130131
* @name ng.$browser#url
@@ -159,14 +160,20 @@ function Browser(window, document, $log, $sniffer) {
159160
baseElement.attr('href', baseElement.attr('href'));
160161
}
161162
} else {
162-
if (replace) location.replace(url);
163-
else location.href = url;
163+
if (replace) {
164+
location.replace(url);
165+
replacedUrl = url;
166+
} else {
167+
location.href = url;
168+
replacedUrl = null;
169+
}
164170
}
165171
return self;
166172
// getter
167173
} else {
174+
// the replacedUrl is a workaround for an issue with location.replace method isn't changing the location.href immediately
168175
// the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
169-
return location.href.replace(/%27/g,"'");
176+
return replacedUrl || location.href.replace(/%27/g,"'");
170177
}
171178
};
172179

0 commit comments

Comments
 (0)