rem:  gSearchTerms[index] = {obj:searchTermObj, scope:scope, searchTerm:searchTerm, initialized:false};  
context: function createSearchRow(index, scope, searchTerm){    var searchAttr = document.createElement("searchattribute");    var searchOp = document.createElement("searchoperator");    var searchVal = document.createElement("searchvalue");    var enclosingBox = document.createElement('vbox');    var buttonBox = document.createElement("hbox");    buttonBox.setAttribute("align", "start");    var moreButton = document.createElement("button");    var lessButton = document.createElement("button");    moreButton.setAttribute("class", "small-button");    moreButton.setAttribute("oncommand", "onMore(event," + (index + 1) + ");");    moreButton.setAttribute('label', '+');    moreButton.setAttribute('tooltiptext', gMoreButtonTooltipText);    lessButton.setAttribute("class", "small-button");    lessButton.setAttribute("oncommand", "onLess(event," + index + ");");        lessButton.setAttribute('label', '\u2212');    lessButton.setAttribute('tooltiptext', gLessButtonTooltipText);    enclosingBox.setAttribute('align', 'right');    // now set up ids:    searchAttr.id = "searchAttr" + index;    searchOp.id  = "searchOp" + index;    searchVal.id = "searchVal" + index;    moreButton.id = "more" + index;    lessButton.id = "less" + index;    buttonBox.appendChild(moreButton);    buttonBox.appendChild(lessButton);    searchAttr.setAttribute("for", searchOp.id + "," + searchVal.id);    searchOp.setAttribute("opfor", searchVal.id);    var rowdata = new Array(enclosingBox, searchAttr,                            null, searchOp,                            null, searchVal,                            null, buttonBox);    var searchrow = constructRow(rowdata);    searchrow.id = "searchRow" + index;    // shift items in gSearchTerms    if (index < gTotalSearchTerms) {      for (var i = gSearchTerms.length - 1; i >= index; --i) {        var nextSearchObj = gSearchTerms[i].obj;        var newSearchObj = new searchTermContainer;        gSearchTerms[i + 1] = {obj:newSearchObj, scope:scope, searchTerm:searchTerm, initialized:true};        var nextSearchAttr = nextSearchObj.searchattribute;        nextSearchAttr.id = "searchAttr" + (i + 1);        var nextSearchOp = nextSearchObj.searchoperator;        nextSearchOp.id = "searchOp" + (i + 1);        var nextSearchVal = nextSearchObj.searchvalue;        nextSearchVal.id = "searchVal" + (i + 1);        nextSearchAttr.setAttribute("for", nextSearchOp.id + "," + nextSearchVal.id);        nextSearchOp.setAttribute("opfor", nextSearchVal.id);        newSearchObj.searchattribute = nextSearchAttr;        newSearchObj.searchoperator = nextSearchOp;        newSearchObj.searchvalue = nextSearchVal;        newSearchObj.booleanNodes = nextSearchObj.booleanNodes;      }    }    var searchTermObj = new searchTermContainer;    gSearchTerms[index] = {obj:searchTermObj, scope:scope, searchTerm:searchTerm, initialized:false};    searchTermObj.searchattribute = searchAttr;    searchTermObj.searchoperator = searchOp;    searchTermObj.searchvalue = searchVal;    // now invalidate the newly created items because they've been inserted    // into the document, and XBL bindings will be inserted in their place    //searchAttr = searchOp = searchVal = undefined;    // and/or string handling:    // this is scary - basically we want to take every other    // listcell, (note the i+=2) which will be a text label,    // and set the searchTermObj's    // booleanNodes to that    var stringNodes = new Array;    var listcells = searchrow.childNodes;    var j=0;    for (var i=0; i<listcells.length; i+=2) {      stringNodes[j++] = listcells[i];      // see bug #183994 for why these cells are hidden      listcells[i].hidden = true;    }    searchTermObj.booleanNodes = stringNodes;    var editFilter = null;    try { editFilter = gFilter; } catch(e) { }    var editMailView = null;    try { editMailView = gMailView; } catch(e) { }    if ((!editFilter && !editMailView) ||        (editFilter && index == gTotalSearchTerms) ||        (editMailView && index == gTotalSearchTerms))      gLoading = false;    // index is index of new row    // gTotalSearchTerms has not been updated yet    if (gLoading || index == gTotalSearchTerms) {      gSearchTermList.appendChild(searchrow);    }    else {      var currentItem = gSearchTermList.getItemAtIndex(index);      resetIdsMore(index);      gSearchTermList.insertBefore(searchrow, currentItem);    }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/3fad157cd62336581af7038755ce7f2ecbe0d695/searchTermOverlay.js/buggy/mailnews/base/search/resources/content/searchTermOverlay.js