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