From 74567b268a879620abb3822ed93f70fd121bb39c Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 29 Aug 2012 07:00:32 +0100 Subject: [PATCH] Fix: Natural sort was leaking variables - 11523 --- sorting/natural.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorting/natural.js b/sorting/natural.js index 44ac229..ea91b43 100644 --- a/sorting/natural.js +++ b/sorting/natural.js @@ -40,8 +40,8 @@ function naturalSort (a, b) { // natural sorting through split numeric strings and default strings for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) { // find floats not starting with '0', string or 0 if not defined (Clint Priest) - oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0; - oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0; + var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0; + var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0; // handle numeric vs string comparison - number < string - (Kyle Adams) if (isNaN(oFxNcL) !== isNaN(oFyNcL)) return (isNaN(oFxNcL)) ? 1 : -1; // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'