From 9200548683dc99cd8df583ca8ab6b3b84382a8b9 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 29 Nov 2008 07:20:23 +0000 Subject: [PATCH] Fix some itemlist bugs. --- content/ui.js | 14 +++++++++----- content/util.js | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/content/ui.js b/content/ui.js index e547560e..be0eb165 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1424,8 +1424,6 @@ function ItemList(id) //{{{ let root = nodes.root let items = nodes.items; let [start, end] = getRows(context); - if (start == end) - return; for (let [i, row] in Iterator(context.getRows(start, end, doc))) nodes[i] = row; @@ -1437,8 +1435,12 @@ function ItemList(id) //{{{ if (display && row.parentNode != items) { do + { var next = nodes[++i]; - while ((!next || next.parentNode != items) && i < end) + if (next && next.parentNode != items) + next = null; + } + while (!next && i < end) items.insertBefore(row, next); } else if (!display && row.parentNode == items) @@ -1508,6 +1510,7 @@ function ItemList(id) //{{{ if (selIndex < 0) newOffset = 0; selIndex = -1; + index = -1; } else { @@ -1523,9 +1526,10 @@ function ItemList(id) //{{{ } if (sel > -1) - getCompletion(selIndex).removeAttribute("selected"); + getCompletion(sel).removeAttribute("selected"); fill(newOffset); - getCompletion(index).setAttribute("selected", "true"); + if (index >= 0) + getCompletion(index).setAttribute("selected", "true"); //if (index == 0) // this.start = now; diff --git a/content/util.js b/content/util.js index 26eaa998..cfcde112 100644 --- a/content/util.js +++ b/content/util.js @@ -290,6 +290,7 @@ const util = { //{{{ try { let xmlhttp = new XMLHttpRequest(); + xmlhttp.mozBackgroundRequest = true; if (callback) { xmlhttp.onreadystatechange = function () {