rem: copy_resource_deeply(all_panels.database, RDF.GetResource(panels[ii]), container); 
add: var id = panels[ii]; var resource = RDF.GetResource(id); if (have_panel_attributes[id]) { container.AppendElement(resource); } else { copy_resource_deeply(all_panels.database, resource, container); } 
context: function Save(){  persist_dialog_dimensions();  var all_panels = document.getElementById('other-panels');  var current_panels = document.getElementById('current-panels');  // See if list membership has changed  var root = document.getElementById('current-panels-root');  var panels = root.childNodes;    var list_unchanged = (panels.length == original_panels.length);  for (var ii = 0; ii < panels.length && list_unchanged; ii++) {    if (original_panels[ii] != panels.item(ii).getAttribute('id')) {      list_unchanged = false;    }  }  if (list_unchanged) {    window.close();    return;  }  // Iterate through the 'current-panels' tree to collect the panels  // that the user has chosen. We need to do this _before_ we remove  // the panels from the datasource, because the act of removing them  // from the datasource will change the tree!  var panels = new Array();  var root = document.getElementById('current-panels-root');  for (var node = root.firstChild; node != null; node = node.nextSibling) {    panels[panels.length] = node.getAttribute('id');  }  // Cut off the connection between the dialog and the datasource.  // The dialog is closed at the end of this function.  // Without this, the dialog tries to update as it is being destroyed.  current_panels.setAttribute('ref', 'rdf:null');  // Create a "container" wrapper around the current panels to  // manipulate the RDF:Seq more easily.  var panel_list = sidebarObj.datasource.GetTarget(RDF.GetResource(sidebarObj.resource), RDF.GetResource(NC+"panel-list"), true);  if (panel_list) {    panel_list.QueryInterface(Components.interfaces.nsIRDFResource);  } else {    // Datasource is busted. Start over.    debug("Sidebar datasource is busted\n");  }  var container = Components.classes["component://netscape/rdf/container"].createInstance();  container = container.QueryInterface(Components.interfaces.nsIRDFContainer);  container.Init(sidebarObj.datasource, panel_list);  // Remove all the current panels from the datasource.  var current_panels = container.GetElements();  while (current_panels.hasMoreElements()) {    panel = current_panels.getNext();    id = panel.QueryInterface(Components.interfaces.nsIRDFResource).Value;    // If this panel is not in the new list,    // or, if description of this panel is in the all panels list,    // then, remove all assertions for the panel to avoid leaving    // unneeded assertions behind and to avoid multiply asserted    // attributes, respectively.    if (!has_element(panels, id) ||         has_targets(all_panels.database, panel)) {      delete_resource_deeply(container, panel);    } else {      container.RemoveElement(panel, false);    }  }  // Add the new list of panels  for (var ii = 0; ii < panels.length; ++ii) {    copy_resource_deeply(all_panels.database, RDF.GetResource(panels[ii]),                         container);  }  refresh_all_sidebars();  // Write the modified panels out.  sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();  window.close();}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/fa409eb51ec17866df85fc6bbbfa2590188c1718/customize.js/buggy/xpfe/components/sidebar/resources/customize.js