From 4dc11cd256630e369ce6d52d68e6ec4681a99b86 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 13 Jun 2012 09:04:54 +0200 Subject: [PATCH] Ox.isEqual(NaN, NaN) should return true --- source/Ox/js/Type.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/Ox/js/Type.js b/source/Ox/js/Type.js index 0f83224e..ce8a18d8 100644 --- a/source/Ox/js/Type.js +++ b/source/Ox/js/Type.js @@ -104,7 +104,7 @@ Ox.isEqual 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;