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

fix(equals): fix #1648 correctly compare objects with undefined member variables #1695

Closed

Conversation

gonzaloruizdevilla
Copy link
Contributor

given a = {} and b = {x:undefined} then
angular.equals(a, b) should be true
angular.equals(b, a) should be true (this happened before)

Closes: #1648

given a = {} and b = {x:undefined} then
angular.equals(a, b) should be true
angular.equals(b, a) should be true (this happened before)

Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
@gonzaloruizdevilla
Copy link
Contributor Author

I've changed the commit message because it wasn't clear at all.

@pkozlowski-opensource
Copy link
Member

Thanks for your contribution! In order for us to be able to accept it, we ask you to sign our CLA (contributor's license agreement).

CLA is important for us to be able to avoid legal troubles down the road.

For individuals (a simple click-through form):
http://code.google.com/legal/individual-cla-v1.0.html

For corporations (print, sign and scan+email, fax or mail):
http://code.google.com/legal/corporate-cla-v1.0.html

@gonzaloruizdevilla
Copy link
Contributor Author

I already signed it when I sent PR #1692
Anyway, I've signed it electronically again.

IgorMinar added a commit to IgorMinar/angular.js that referenced this pull request Jan 18, 2013
previously:

a = {};
b = {x:undefined};
angular.equals(a, b) == angular.equals(b, a) // returns false.

both should return false because these objects are not equal.

unlike in implemented in angular#1695 the comparison should be stricter
and return false not true. if we need to relax this in the future
we can always do so.

Closes angular#1648
@IgorMinar
Copy link
Contributor

I took a slightly different approach and fixed this with 124e9b8

thanks for sharing your solution though

@IgorMinar IgorMinar closed this Jan 18, 2013
IgorMinar added a commit that referenced this pull request Jan 18, 2013
previously:

a = {};
b = {x:undefined};
angular.equals(a, b) == angular.equals(b, a) // returns false.

both should return false because these objects are not equal.

unlike in implemented in #1695 the comparison should be stricter
and return false not true. if we need to relax this in the future
we can always do so.

Closes #1648
IgorMinar added a commit that referenced this pull request Jan 18, 2013
previously:

a = {};
b = {x:undefined};
angular.equals(a, b) == angular.equals(b, a) // returns false.

both should return false because these objects are not equal.

unlike in implemented in #1695 the comparison should be stricter
and return false not true. if we need to relax this in the future
we can always do so.

Closes #1648
jamessharp pushed a commit to jamessharp/angular.js that referenced this pull request Jan 18, 2013
previously:

a = {};
b = {x:undefined};
angular.equals(a, b) == angular.equals(b, a) // returns false.

both should return false because these objects are not equal.

unlike in implemented in angular#1695 the comparison should be stricter
and return false not true. if we need to relax this in the future
we can always do so.

Closes angular#1648
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

angular.equals(a, b) != angular.equals(b, a) where a = {} && b = {x:undefined}
3 participants