fixed #261 (less tolerant null-value-to-number-coercion)

pull/3/merge
jmoenig 2013-12-04 11:11:07 +01:00
rodzic a845696223
commit d9b9c6bad1
2 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -2025,3 +2025,4 @@ ______
* Threads: handle text comparisons case-insensitive (again)
* Lists: harmonize equality testing and List CONTAINS testing
* French translation update, thanks, Martin!
* Threads: fixed #261 (less tolerant null-value-to-number-coercion)

Wyświetl plik

@ -98,9 +98,15 @@ function snapEquals(a, b) {
}
return false;
}
var x = +a,
y = +b;
if (isNaN(x) || isNaN(y)) {
y = +b,
specials = [true, false, '', 0];
// check for special values before coercing to numbers
if (isNaN(x) || isNaN(y) ||
[a, b].some(function (any) {return contains(specials, any) ||
(any.indexOf(' ') > -1); })) {
x = a;
y = b;
}