Re-use the auto suggestion box and make sure it's not overlapped

This commit is contained in:
Alexander Butenko 2009-12-17 20:55:50 +01:00 committed by Christian Dywan
parent cbfe1504b0
commit e1b82af2c7
2 changed files with 13 additions and 5 deletions

View file

@ -5,6 +5,7 @@ div.suggestions {
text-align: left;
background-color: #ffffff;
position: absolute;
z-index: 999;
}
div.suggestions div {
cursor: default;

View file

@ -53,12 +53,18 @@ AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/) {
AutoSuggestControl.prototype.createDropDown = function () {
var oThis = this;
//create the layer and assign styles
var sDiv = document.getElementById("suggestions_box");
if (sDiv)
this.layer = sDiv;
else
{
this.layer = document.createElement("div");
this.layer.className = "suggestions";
this.layer.id = "suggestions_box";
this.layer.style.visibility = "hidden";
this.layer.style.width = this.textbox.offsetWidth;
}
this.layer.onmousedown =
this.layer.onmouseup =
this.layer.onmouseover = function (oEvent) {
@ -275,6 +281,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/
this.layer.style.left = this.getLeft() + "px";
this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
this.layer.style.visibility = "visible";
this.layer.style.position = "absolute";
};
/**