Ox.isEqual(NaN, NaN) should return true

This commit is contained in:
rolux 2012-06-13 09:04:54 +02:00
parent bc83d22850
commit 4dc11cd256

View file

@ -104,7 +104,7 @@ Ox.isEqual <function> Returns true if two values are equal
> Ox.isEqual(Infinity, -Infinity)
false
> Ox.isEqual(NaN, NaN)
false
true
> Ox.isEqual(document.getElementsByTagName('a'), document.getElementsByTagName('a'))
true
> Ox.isEqual(null, null)
@ -136,7 +136,8 @@ Ox.isEqual = function(a, b) {
// 0 === -0, but not equal
ret = a !== 0 || 1 / a === 1 / b;
} else if (type == Ox.typeOf(b)) {
if (a == b) {
// NaN !== NaN, but equal
if (a == b || a !== b) {
ret = true;
} else if (type == 'date') {
ret = +a == +b;