diff options
| author | Misko Hevery | 2012-05-07 11:51:39 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2012-05-07 15:43:09 -0700 | 
| commit | b99f65f64d1e54315b3210d78a9a9adbcf34c96c (patch) | |
| tree | f5cee90ba30b01b3772b43e1c52cf7d6674d167e | |
| parent | f76474823a8eeca31b72d9eadce55ceefb68f014 (diff) | |
| download | angular.js-b99f65f64d1e54315b3210d78a9a9adbcf34c96c.tar.bz2 | |
bug(html5 navigation): broken in Opera
http://my.opera.com/community/forums/topic.dml?id=1185462
Closes# 938
| -rw-r--r-- | src/ng/browser.js | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/src/ng/browser.js b/src/ng/browser.js index 9dce89db..6acb8baa 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -123,7 +123,8 @@ function Browser(window, document, $log, $sniffer) {    // URL API    ////////////////////////////////////////////////////////////// -  var lastBrowserUrl = location.href; +  var lastBrowserUrl = location.href, +      baseElement = document.find('base');    /**     * @ngdoc method @@ -152,7 +153,11 @@ function Browser(window, document, $log, $sniffer) {        lastBrowserUrl = url;        if ($sniffer.history) {          if (replace) history.replaceState(null, '', url); -        else history.pushState(null, '', url); +        else { +          history.pushState(null, '', url); +          // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462 +          baseElement.attr('href', baseElement.attr('href')); +        }        } else {          if (replace) location.replace(url);          else location.href = url; @@ -231,7 +236,7 @@ function Browser(window, document, $log, $sniffer) {     * @returns {string=}     */    self.baseHref = function() { -    var href = document.find('base').attr('href'); +    var href = baseElement.attr('href');      return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;    }; | 
