rem: ref = engineList.getAttribute("ref"); if (ref) engineList.setAttribute("ref", ref); 
add: engineList.builder.rebuild(); engineList.addEventListener("CheckboxStateChange", saveEngine, false); 
context: function SearchPanelStartup(){  searchBundle = document.getElementById("searchBundle");  var rdf  = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);  rootNode = rdf.GetResource("NC:LastSearchRoot", true);  textArc  = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);  modeArc  = rdf.GetResource("http://home.netscape.com/NC-rdf#SearchMode", true);    ensureSearchPref()    var resultList = document.getElementById("resultList");  resultList.database.AddObserver(RDF_observer);  var categoryList = document.getElementById("categoryList");  var internetSearch = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);  var catDS = internetSearch.GetCategoryDataSource();  if (catDS) {    catDS = catDS.QueryInterface(nsIRDFDataSource);    categoryList.database.AddDataSource(catDS);    var ref = categoryList.getAttribute("ref");    if (ref)      categoryList.setAttribute("ref", ref);    var engineList = document.getElementById("searchengines");    engineList.database.AddDataSource(catDS);    ref = engineList.getAttribute("ref");    if (ref)      engineList.setAttribute("ref", ref);  }  // try and determine last category name used  var lastCategoryName = nsPreferences.copyUnicharPref("browser.search.last_search_category", "");  if (lastCategoryName) {    // strip off the prefix if necessary    var prefix = "NC:SearchCategory?category=";    if (lastCategoryName.indexOf(prefix) == 0)      lastCategoryName = lastCategoryName.substr(prefix.length);  }  // select the appropriate category  var categoryPopup = document.getElementById("categoryPopup");  var found = false;  for (var i = 0; i < categoryPopup.childNodes.length; ++i) {    if (lastCategoryName == "" &&        categoryPopup.childNodes[i].getAttribute("value") == "NC:SearchEngineRoot" ||        categoryPopup.childNodes[i].getAttribute("id") == lastCategoryName)    {      categoryList.selectedItem = categoryPopup.childNodes[i];      found = true;      break;    }  }  if (!found)    categoryList.selectedItem = categoryPopup.childNodes[0];  if (!lastCategoryName)    lastCategoryName = "NC:SearchEngineRoot";  else if (lastCategoryName != "NC:SearchEngineRoot")    lastCategoryName = "NC:SearchCategory?category=" + lastCategoryName;  var treeNode = document.getElementById("searchengines");  treeNode.setAttribute("ref", lastCategoryName);  loadEngines(lastCategoryName);  // if we have search results, show them, otherwise show engines  if (updateSearchMode() != 0)  {    if (haveSearchResults())      switchTab(0);    else      switchTab(1);  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/7fced3197690f5cdb19e29892f738f82eef89b53/search-panel.js/clean/xpfe/components/search/resources/search-panel.js