[PATCH] Variable should be declared before loop

Miika Turkia miika.turkia at gmail.com
Mon Dec 1 19:59:57 PST 2014


Fixing incorrect variable scope. (I do not really see any functional
differences on Firefox, but better declare the variable before the
loop.)

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 theme/list_lib.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index e50fc39..6fde541 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -431,10 +431,12 @@ function sort_it(sortOn, function_)
 	for (var j = 0; j < itemsToShow.length; j++) {
 		visited[j] = false;
 	}
+
+	var iSmaller;
 	for (var i = 0; i < itemsToShow.length; i++) {
 		for (var j = 0; j < itemsToShow.length; j++)
 			if (visited[j] === false)
-				var iSmaller = j;
+				iSmaller = j;
 		for (var j = 0; j < itemsToShow.length; j++) {
 			if (function_(itemsToShow[j], itemsToShow[iSmaller])) {
 				if (visited[j] === false) {
-- 
1.9.1



More information about the subsurface mailing list