From d9b9c6bad1b2435e06b8066857a2fb3d1ce03411 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 4 Dec 2013 11:11:07 +0100 Subject: fixed #261 (less tolerant null-value-to-number-coercion) --- threads.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'threads.js') diff --git a/threads.js b/threads.js index 727aedf..9727e18 100644 --- a/threads.js +++ b/threads.js @@ -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; } -- cgit v1.3.1