Fix issues with Base.equals().

This commit is contained in:
Jürg Lehni 2012-11-05 10:56:53 -08:00
parent 65f1e5c66d
commit 0a537f0712

7
lib/bootstrap.js vendored
View file

@ -234,8 +234,10 @@ var Base = new function() { // Bootstrap scope
* equals() methods if available, and also comparing elements of arrays.
*/
function equals(obj1, obj2) {
if (obj1 == obj2 || obj1 != null && obj1.equals && obj1.equals(obj2))
if (obj1 == obj2)
return true;
if (obj1 != null && obj1.equals)
return obj1.equals(obj2);
if (isArray(obj1) && isArray(obj2)) {
if (obj1.length !== obj2.length)
return false;
@ -244,7 +246,8 @@ var Base = new function() { // Bootstrap scope
return false;
}
return true;
} else if (typeof obj1 === 'object' && typeof obj2 === 'object') {
}
if (typeof obj1 === 'object' && typeof obj2 === 'object') {
function checkKeys(o1, o2) {
for (var i in o1)
if (typeof o2[i] === 'undefined')