rem: if (max.value) { var newIndex = max.value - (max.value - min.value); 
add: if (max.value != -1) { var newIndex = min.value; 
context: function nsTreeController_delete(){    var rangeCount = this.treeSelection.getRangeCount();  if (rangeCount < 1)    return false;          var datasource = this.tree.database;  var dsEnum = datasource.GetDataSources();  dsEnum.getNext();  var ds = dsEnum.getNext()                 .QueryInterface(Components.interfaces.nsIRDFDataSource);  var count = this.treeSelection.count;    // XXX 9 is a random number, just looking for a sweetspot  // don't want to rebuild tree content for just a few items  if (count > 9) {    ds.beginUpdateBatch();  }  var min = new Object();   var max = new Object();  var dirty = false;  for (var i = rangeCount - 1; i >= 0; --i) {    this.treeSelection.getRangeAt(i, min, max);    for (var k = max.value; k >= min.value; --k) {      if (!gRDF)        gRDF = Components.classes[rdf_contractid].getService(Components.interfaces.nsIRDFService);      var IDRes = this.treeBuilder.getResourceAtIndex(k);      if (!IDRes)        continue;      var root = this.tree.getAttribute('ref');      var parentIDRes;      try {        parentIDRes = this.treeBuilder.getResourceAtIndex(this.treeView.getParentIndex(k));      }      catch(ex) {        parentIDRes = gRDF.GetResource(root);      }      if (!parentIDRes)        continue;            // otherwise remove the parent/child assertion then      var containment = gRDF.GetResource("http://home.netscape.com/NC-rdf#child");      ds.Unassert(parentIDRes, containment, IDRes);      dirty = true;    }  }  if (count > 9) {    ds.endUpdateBatch();  }  if (dirty) {        try {      var remote = datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);      remote.Flush();    } catch (ex) {    }  }  if (max.value) {    var newIndex = max.value - (max.value - min.value);    if (newIndex >= this.treeView.rowCount)      --newIndex;    this.treeSelection.select(newIndex);  }  return true;}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/8395/aa05ca2f374a7db6043dc85c5f8ffc2d62fdcdb2/nsTreeController.js/clean/toolkit/obsolete/content/nsTreeController.js