Fix for bug 41266. Don't clone the popup node else the XBL binding wont work! Also, close the popup menu when the use start typing again else it will not open all the time. R=mscott

This commit is contained in:
ducarroz%netscape.com 2000-06-15 01:48:41 +00:00
parent 3e241020a1
commit 1244429e57

View File

@ -124,7 +124,13 @@
return;
popupset = document.getAnonymousNodes(me)[0].childNodes[1];
popupElement = popupset.firstChild.cloneNode(false);
popupElement = popupset.firstChild;
//First, remove all the current menu items
for (i = popupElement.childNodes.length - 1; i >= 0 ; i --)
popupElement.removeChild(popupElement.childNodes[i]);
//Then build the new menu items
for (i = 0; i < result.items.Count(); i ++)
{
item = result.items.QueryElementAt(i, Components.interfaces.nsIAutoCompleteItem);
@ -135,7 +141,6 @@
// dump(" match=" + item.value + "\n");
}
// dump(" count=" + result.items.Count() + ", default=" + result.defaultItemIndex + "\n");
popupset.replaceChild(popupElement, popupset.firstChild);
if (result.defaultItemIndex != -1)
{
//TODO: Select the default item
@ -144,7 +149,7 @@
me.privatefunc.selectedItemIndex = result.defaultItemIndex;
if (result.defaultItemIndex != 0 || result.items.Count() != 1)
{
me.privatefunc.closePopupMenu(me); //Close it first as openPopup seems to work as a toggle!
// me.privatefunc.closePopupMenu(me); //Close it first as openPopup seems to work as a toggle!
popupset.firstChild.openPopup(document.getAnonymousNodes(me)[0].firstChild, -1, -1, "popup", "bottomleft", "topleft");
}
},
@ -198,7 +203,7 @@
break;
case 'stopLookup':
// me.privatefunc.closePopupMenu(me);
me.privatefunc.closePopupMenu(me);
me.autoCompleteSession.onStopLookup();
break;