Updated JQuery ResizeComplete method

HTML Source EditorWord wrap

I made 2 slight changes and I think it works pretty well now.  I now detect if the browser is Firefox and use the regular resize event since its resize behaves like a resizeComplete.  I also modified the timeout a bit since I think 100 ms might be too small.

Here is the updated version:

jQuery.fn.resizeComplete = function(callback)
{

 var element = this;
 var height = element.height();
 var width = element.width();
 var monitoring = false;
 var timer;
 
 function monitorResizing()
 {
   monitoring = true;
   
   var newHeight = element.height();
   var newWidth = element.width();
   
   if(newHeight != height || newWidth != width)
   {
     height = newHeight;
     width = newWidth;
     timer = setTimeout(function() { monitorResizing() },200);
   }
   else
   {
     monitoring = false;
     clearTimeout(timer);
     callback();
   }
 }
 
 function onResize()
 {
   if(monitoring) return;
   monitorResizing();
 }
 
 if($.browser.mozilla)
 {
   element.resize(callback);
 }
 else
 {
   element.resize(onResize);
 }
 
 
}