browser: search browser platform
[sheet.git] / searchlocal.js
index 8c33f8d0f0c5bb1451d34af494dd9f8e82c90c8b..752a3eec876a70af70ec1da40723a52447e18ac8 100644 (file)
@@ -29,20 +29,16 @@ function filtercell(el, set, action) {
 }
 
 function filtercols(table, match, action) {
-       var matchloc;
+       var matchloc = [];
        for (var y = 0; y < table.rows.length; y++) {
                var loc = 0;
                for (var x = 0; x < table.rows[y].cells.length; x++) {
                        var cell = table.rows[y].cells[x];
-                       if (y == 0) {
-                               if (match(cell)) {
-                                       if (!matchloc) matchloc = [loc];
-                                       matchloc[1] = loc + cell.colSpan;
-                                       filtercell(table.children.item(x), true, action); // colgroup
-                               }
+                       if (y == 0 && match(cell)) {
+                               for (var i = loc; i < loc + cell.colSpan; i++) matchloc[i] = true;
+                               filtercell(table.children.item(x), true, action); // colgroup
                        }
-                       var keep = matchloc && loc >= matchloc[0] && loc < matchloc[1];
-                       filtercell(cell, keep, action);
+                       filtercell(cell, matchloc[loc], action);
                        loc += cell.colSpan;
                }
        }