aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ng/location.js13
-rw-r--r--test/ng/locationSpec.js24
2 files changed, 2 insertions, 35 deletions
diff --git a/src/ng/location.js b/src/ng/location.js
index 85f780e2..9bb4d417 100644
--- a/src/ng/location.js
+++ b/src/ng/location.js
@@ -178,11 +178,6 @@ function LocationHashbangUrl(appBase, hashPrefix) {
throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url,
hashPrefix);
}
-
- if (withoutHashUrl === '' && withoutBaseUrl.charAt(0) === '?') {
- withoutHashUrl = withoutBaseUrl;
- }
-
parseAppUrl(withoutHashUrl, this, appBase);
this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
@@ -233,14 +228,10 @@ function LocationHashbangUrl(appBase, hashPrefix) {
*/
this.$$compose = function() {
var search = toKeyValue(this.$$search),
- hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '',
- url = '';
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
- if (this.$$url) {
- url = this.$$path ? hashPrefix + this.$$url : this.$$url;
- }
- this.$$absUrl = appBase + url;
+ this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
};
this.$$rewrite = function(url) {
diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js
index 8ff5da30..ff823d30 100644
--- a/test/ng/locationSpec.js
+++ b/test/ng/locationSpec.js
@@ -1487,30 +1487,6 @@ describe('$location', function() {
expect(location.url()).toBe('/not-starting-with-slash');
expect(location.absUrl()).toBe('http://server/pre/index.html#/not-starting-with-slash');
});
-
- describe("search()", function() {
- it("should return a populated search object for search query when path is empty", function() {
- location = new LocationHashbangUrl('http://server/pre/index.html', '!');
-
- location.$$parse('http://server/pre/?foo=1&bar=2&baz=3');
- expect(location.path()).toBe('');
- expect(location.absUrl()).toBe('http://server/pre/index.html?foo=1&bar=2&baz=3')
- expect(location.search()).toEqual({
- foo: '1',
- bar: '2',
- baz: '3'
- });
-
- location.$$parse('http://server/pre/index.html?foo=1&bar=2&baz=3');
- expect(location.path()).toBe('');
- expect(location.absUrl()).toBe('http://server/pre/index.html?foo=1&bar=2&baz=3')
- expect(location.search()).toEqual({
- foo: '1',
- bar: '2',
- baz: '3'
- });
- });
- });
});