rem: if (debug) XRai.debug("Removing passage " + z.getPaths() + (z.next ? " - next conflict: " + z.next.getPaths() : " - no next conflict") + "\n"); 
add: if (debug) XRai.debug("Removing passage " + z.getPaths() + (z.next ? " - next conflict: " + z.next.getPaths() : " - no next conflict") + "\n"); 
context: XRai.unhighlight = function() {   if (docStatus != 0) return;   var toremove = new Array();   var toadd = new Array();   try {      var sel = XRai.getSelection();      if (sel == null) return;      var x = sel.x;      var y = sel.y;      XRai.history.push(new Array("U",XRai.getTimeString(),x,y));      if (debug) {         if (debug) XRai.debug("\nUNHIGHLIGHTING START\n");         if (debug) XRai.debug(XRai.getPath(x) + " -> " + XRai.getPath(y) + "\n");         XRai.log("Unhighlighting: " + XRai.getPath(x) + " -> " + XRai.getPath(y));      }      // Find the first passage      z = XRai.firstPassage;      while (z && (XRai.isAfter(x,z.end) && !XRai.isIn(x,z.end)))  {         if (debug) XRai.debug("Skipping conflicting passage: " + z.getPaths() +"\n");         z = z.next;      }      if (debug && z) {         if (debug) XRai.debug("Next conflicting passage is " + z.getPaths() +"\n");      }      var firstRemoved = false;      // Check overlap with z/x      if (z && (XRai.isAfter(x,z.start) || XRai.isIn(x,z.end))) {         // Break the node         toremove.push(z);         toadd.push(new Array(z.start, XRai.previousElementTo(x,z.start)));         if (debug) XRai.debug("Intersection(" + z.getPaths() + " with start: " + XRai.getPath(x) + ") => "               + XRai.getPath(XRai.previousElementTo(x,z.start)) + "\n");         firstRemoved = true;      }      // While y is after z end      if (debug) if (z) XRai.debug("Check for included passages to remove with y=" + XRai.getPath(y) + " and " + XRai.getPath(z.end) + "\n"); else XRai.debug("No more conflicting and included passage for removing\n");      for(; z && (XRai.isAfter(y,z.end) || y == z.end); z = z.next) {         if (debug) XRai.debug("Removing passage " + z.getPaths() + (z.next ? " - next conflict: " + z.next.getPaths() : " - no next conflict") + "\n");         if (!firstRemoved) toremove.push(z);         firstRemoved = false;      }      // Check overlap z/y      if (debug) if (z) XRai.debug("Check if we have to add a segment from y=" + XRai.getPath(y) + " to " + XRai.getPath(z.end) + "\n"); else XRai.debug("No more conflicting passage for rehighlighting after passage\n");      if (z && (compareDocumentPosition(z.end,y) && DOCUMENT_ORDER_BEFORE)) {         if (debug) XRai.debug("Removing last conflicting passage " + z.getPaths() + " for " + XRai.getPath(y) + "\n");         if (!firstRemoved) toremove.push(z);         toadd.push(new Array(XRai.nextElementTo(y,z.end),z.end));      }      try {         for(var i = 0; i < toremove.length; i++) toremove[i].unhighlight();         for(var i = 0; i < toadd.length; i++) new Passage(toadd[i][0], toadd[i][1]);      } catch (error) {         alert("Unrecoverable error: you should stop assessing WITHOUT SAVING and fill a bug report\n\n" + error);         if (debug) throw error;      }   } catch(error) {         alert("Recoverable error: you should stop assessing, save your assessments and fill a bug report\n\n" + error);         if (debug) throw error;   }   if (debug) XRai.dumpPassages();   XRai.updateSaveIcon();}
meta: 8632	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8632/8d54a3c1667f8747348382c8c113b82a0452cb41/article.js/buggy/trunk/js/article.js