Bug 398414 - "in file listings front-end code, build the gRows array lazily" [p=dao r+sr=bzbarsky a1.9=sayrer]

This commit is contained in:
reed@reedloden.com 2007-10-12 21:00:58 -07:00
parent 4ff6a5fc98
commit f60da8dc70

View File

@ -391,12 +391,9 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
" headCells[i].appendChild(anchor);\n" " headCells[i].appendChild(anchor);\n"
" headCells[i].addEventListener(\"click\", rowAction(i), true);\n" " headCells[i].addEventListener(\"click\", rowAction(i), true);\n"
" }\n" " }\n"
" gRows = [];\n" " if (gUI_showHidden) {\n"
" for (var row, i = gTBody.rows.length - 1; i >= 0; i--) {\n" " gRows = Array.slice(gTBody.rows);\n"
" row = gTBody.rows[i];\n" " hiddenObjects = gRows.some(function (row) row.className == \"hidden-object\");\n"
" gRows[i] = row;\n"
" if (gUI_showHidden && !hiddenObjects)\n"
" hiddenObjects = (row.className == \"hidden-object\");\n"
" }\n" " }\n"
" gTable.setAttribute(\"order\", \"\");\n" " gTable.setAttribute(\"order\", \"\");\n"
" if (hiddenObjects) {\n" " if (hiddenObjects) {\n"
@ -423,6 +420,8 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
" return 0;\n" " return 0;\n"
"}\n" "}\n"
"function orderBy(column) {\n" "function orderBy(column) {\n"
" if (!gRows)\n"
" gRows = Array.slice(gTBody.rows);\n"
" var order;\n" " var order;\n"
" if (gOrderBy == column) {\n" " if (gOrderBy == column) {\n"
" order = gTable.getAttribute(\"order\") == \"asc\" ? \"desc\" : \"asc\";\n" " order = gTable.getAttribute(\"order\") == \"asc\" ? \"desc\" : \"asc\";\n"