From 8b0ebc752744d27678d42af10aa53d762c403973 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 3 Oct 2014 22:42:32 -0400 Subject: [PATCH 1/2] =?UTF-8?q?revert:=20fix($browser):=20don=E2=80=99t=20?= =?UTF-8?q?use=20history=20api=20when=20only=20the=20hash=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 858360b680a2bb5c19429c1be1c9506700cda476. (Just to make it easier) --- src/ng/browser.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ng/browser.js b/src/ng/browser.js index e78c90ffd37b..583468eaa7b6 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -1,5 +1,4 @@ 'use strict'; -/* global stripHash: true */ /** * ! This is a private undocumented service ! From 25cd1daa266667fdcddd69cd85a588a9e985287d Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 3 Oct 2014 22:43:32 -0400 Subject: [PATCH 2/2] =?UTF-8?q?revert:=20fix($browser):=20don=E2=80=99t=20?= =?UTF-8?q?use=20history=20api=20when=20only=20the=20hash=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0656484d3e709c5162570b0dd6473b0b6140e5b2 due to a failing test in IE9. --- src/ng/browser.js | 7 +------ src/ng/location.js | 3 --- test/ng/browserSpecs.js | 22 ---------------------- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/src/ng/browser.js b/src/ng/browser.js index 583468eaa7b6..e97592d5d750 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -153,13 +153,8 @@ function Browser(window, document, $log, $sniffer) { // setter if (url) { if (lastBrowserUrl == url) return; - var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url); lastBrowserUrl = url; - // Don't use history API if only the hash changed - // due to a bug in IE10/IE11 which leads - // to not firing a `hashchange` nor `popstate` event - // in some cases (see #9143). - if (!sameBase && $sniffer.history) { + if ($sniffer.history) { if (replace) history.replaceState(null, '', url); else { history.pushState(null, '', url); diff --git a/src/ng/location.js b/src/ng/location.js index f7275319dcb9..5e425ab0d65a 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -720,9 +720,6 @@ function $LocationProvider(){ if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) { if ($location.$$parseLinkUrl(absHref, relHref)) { - // We do a preventDefault for all urls that are part of the angular application, - // in html5mode and also without, so that we are able to abort navigation without - // getting double entries in the location history. event.preventDefault(); // update location manually if ($location.absUrl() != $browser.url()) { diff --git a/test/ng/browserSpecs.js b/test/ng/browserSpecs.js index 86d2db7a77bb..401e40597975 100755 --- a/test/ng/browserSpecs.js +++ b/test/ng/browserSpecs.js @@ -445,17 +445,6 @@ describe('browser', function() { expect(locationReplace).not.toHaveBeenCalled(); }); - it('should set location.href and not use pushState when the url only changed in the hash fragment to please IE10/11', function() { - sniffer.history = true; - browser.url('http://server/#123'); - - expect(fakeWindow.location.href).toEqual('http://server/#123'); - - expect(pushState).not.toHaveBeenCalled(); - expect(replaceState).not.toHaveBeenCalled(); - expect(locationReplace).not.toHaveBeenCalled(); - }); - it('should use location.replace when history.replaceState not available', function() { sniffer.history = false; browser.url('http://new.org', true); @@ -467,17 +456,6 @@ describe('browser', function() { expect(fakeWindow.location.href).toEqual('http://server/'); }); - it('should use location.replace and not use replaceState when the url only changed in the hash fragment to please IE10/11', function() { - sniffer.history = true; - browser.url('http://server/#123', true); - - expect(locationReplace).toHaveBeenCalledWith('http://server/#123'); - - expect(pushState).not.toHaveBeenCalled(); - expect(replaceState).not.toHaveBeenCalled(); - expect(fakeWindow.location.href).toEqual('http://server/'); - }); - it('should return $browser to allow chaining', function() { expect(browser.url('http://any.com')).toBe(browser); });