title: jQuery .remove() call in callback triggers infinite loop
body: <p>While I have the problem itself seemingly resolved, I'm hoping someone can shed some light on the <em>why</em> of this...</p>
  
  <p>Below are two snapshots of the same function whose job is to remove a div that contains a user feedback message.  It's setup to use an optional timeout, if a timeout is specified it makes a call to itself using setTimeout() which then removes the div.</p>
  
  <p>The only difference between the two versions of the function is where <strong>this.remove()</strong> is called - in the problem version I send a message to the log using <a href="http://code.google.com/p/blackbirdjs/" rel="nofollow noreferrer">blackbirdjs</a> first and then call this.remove() - after this executes the log is flooded with unending log messages of "Removing feedback div..." as fast as the browser can pump them in.</p>
  
  <p>In the working version, however, I simply reverse the order and everything executes normally and all is well...</p>
  
  <p>I'm boggled, I would think that the order in this case would be trivial but apparently not.  Can anyone shed some light on why this would be happening?  Is this a jQuery bug or a problem with blackbird or some kind of weird quirk of JavaScript in general?</p>
  
  <p><strong>NOTE:</strong><br>
  I had some mixed success using a call to confirm() - if it came back false I told it to return and this stopped it - however, just adding return after the remove call had no effect.</p>
  
  <p>Interestingly enough, either version seems to work fine in IE8 - so this may be a firefox/gecko problem?</p>
  
  <p><strong>Problem Code:</strong></p>
  
  <pre><code>function clear_feedback(target_container, timeout){
      log.debug("timeout: " + timeout);
      log.debug("target_container: " + target_container);
  
      if(timeout == undefined){
          log.info("removing target...");
  
          $(target_container).children(".update_feedback").slideUp("slow",
              function() {
                  log.info("Removing feedback div...");
                  this.remove();
              }
          );
      }
      else{
          log.info("Setting timeout, THEN removing target...");
  
          setTimeout("clear_feedback('" + target_container + "')", timeout);
      }
  }
  </code></pre>
  
  <p><strong>Working Code:</strong></p>
  
  <pre><code>function clear_feedback(target_container, timeout){
      log.debug("timeout: " + timeout);
      log.debug("target_container: " + target_container);
  
      if(timeout == undefined){
          log.info("removing target...");
  
          $(target_container).children(".update_feedback").slideUp("slow",
              function() {
                  this.remove();
                  log.info("Removing feedback div...");
              }
          );
      }
      else{
          log.info("Setting timeout, THEN removing target...");
  
          setTimeout("clear_feedback('" + target_container + "')", timeout);
      }
  }
  </code></pre>