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

Fixes bug when $location.search() is not returning actual search part of current url. #9410

Closed
wants to merge 15 commits into from

Conversation

bullgare
Copy link
Contributor

@bullgare bullgare commented Oct 3, 2014

The issue appears when we set $location.search() with some object and after that change this object's properties, like that:

var obj = {foo: 'bar'};
$location.search(obj); // now url is set to '#?foo=bar'
obj.foo = 'boo';
var currentUrlObj = $location.search();
// current location is still '#?foo=bar' 
// while currentUrlObj is telling that current url object is {foo: 'boo'}
// which isn't correct

There's a little demo onJSBin:
http://jsbin.com/rekana/5/edit?js,output
And another JSBin with behaviour fixed on consumer's side:
http://jsbin.com/rekana/1/edit?js,output
I'm sure it's a bad idea to make someone think of that on the consumer's side.

@bullgare bullgare changed the title Fixes bug when $location.search() is not returning search part of current url. Fixes bug when $location.search() is not returning actual search part of current url. Oct 3, 2014
The jQuery css() getter functionality utilises getComputedStyle() whereas
jqLite only retrieves what is declared inline on an element.

Closes angular#7599
Marcy Sutton and others added 9 commits October 3, 2014 14:05
This fixes the case when a directive that uses `templateUrl`
is used somewhere in the children
of a transcluding directive like `ng-repeat`.

Fixes angular#9344
Related to angular#8808
Closes angular#9415
IE10/11 have the following problem: When changing the url hash
via `history.pushState()` and then reverting the hash via direct
changes to `location.href` (or via a link) does not fire a
`hashchange` nor `popstate` event.

This commit changes the default behavior as follows:
Uses `location.href`/`location.replace` if the new url differs from
the previous url only in the hash fragment or the browser
does not support history API.
Use `history.pushState`/ `history.replaceState` otherwise.

Fixes angular#9143
Closes angular#9406
…mitives

When server responds with Content-Type header set to application/json we now properly parse the response as JSON

Closes angular#2973
…ingle root node

The compiler will no longer throw if a directive template contains comment nodes in addition to a
single root node. If a template contains less than 2 nodes, the nodes are unaltered.

BREAKING CHANGE:

If a template contains directives within comment nodes, and there is more than a single node in the
template, those comment nodes are removed. The impact of this breaking change is expected to be
quite low.

Closes angular#9212
Closes angular#9215
Fixes a failing test on IE9 caused as a side effect
of 404b95f being merged
before 0656484.

The test should have been independent on the browser running it
and it is now.

Closes angular#9423
Closes angular#9424
@bullgare
Copy link
Contributor Author

bullgare commented Oct 4, 2014

@caitp please make the code review.
There's just one line of code.

@caitp
Copy link
Contributor

caitp commented Oct 5, 2014

@bullgare you really need to provide one (or more) unit tests for any functional change.

I can see from reading the code what the specific bug is that you're fixing, but we definitely need a test case

@@ -480,7 +480,7 @@ LocationHashbangInHtml5Url.prototype =
if (value == null) delete search[key];
});

this.$$search = search;
this.$$search = extend({}, search);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do this here.

Instead, use search = copy(search, {}) a few lines up, before the forEach() line (so that we don't make changes to the user-specified object, and so that we get a deep copy)

@bullgare
Copy link
Contributor Author

bullgare commented Oct 5, 2014

Thanks, @caitp.
You're right.
I'll do that.

@bullgare
Copy link
Contributor Author

bullgare commented Oct 6, 2014

This one is closed due to some merge issues.
I started new one - #9445

@bullgare bullgare deleted the location.search-setter-fix branch October 6, 2014 14:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.