diff options
| author | Angel Balcarcel | 2013-08-09 10:29:22 -0400 | 
|---|---|---|
| committer | Brian Ford | 2013-10-02 15:33:31 -0700 | 
| commit | d70711481e6311c9cd283d650f07ca0cca72ecc2 (patch) | |
| tree | b8bc70a4bab8eb0a90897172513429271d671228 /src/ng/browser.js | |
| parent | 78a5889bc691d95e5b037c99de3607f02a69a188 (diff) | |
| download | angular.js-d70711481e6311c9cd283d650f07ca0cca72ecc2.tar.bz2 | |
fix($location): prevent infinite digest error in IE7
Refactored `replacedUrl` to store the new URL on both
`location.replace` and setting `location.href` directly to handle
delays in the actual location value change in IE.
Closes #2802
Diffstat (limited to 'src/ng/browser.js')
| -rw-r--r-- | src/ng/browser.js | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/src/ng/browser.js b/src/ng/browser.js index 768720e7..7a0e3fec 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -125,7 +125,7 @@ function Browser(window, document, $log, $sniffer) {    var lastBrowserUrl = location.href,        baseElement = document.find('base'), -      replacedUrl = null; +      newLocation = null;    /**     * @name ng.$browser#url @@ -163,21 +163,20 @@ function Browser(window, document, $log, $sniffer) {            baseElement.attr('href', baseElement.attr('href'));          }        } else { +        newLocation = url;          if (replace) {            location.replace(url); -          replacedUrl = url;          } else {            location.href = url; -          replacedUrl = null;          }        }        return self;      // getter      } else { -      // - the replacedUrl is a workaround for an IE8-9 issue with location.replace method that doesn't update -      //   location.href synchronously +      // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href +      //   methods not updating location.href synchronously.        // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 -      return replacedUrl || location.href.replace(/%27/g,"'"); +      return newLocation || location.href.replace(/%27/g,"'");      }    }; @@ -185,6 +184,7 @@ function Browser(window, document, $log, $sniffer) {        urlChangeInit = false;    function fireUrlChange() { +    newLocation = null;      if (lastBrowserUrl == self.url()) return;      lastBrowserUrl = self.url(); | 
