XUL, jQuery.ready, 1.3.2 vs 1.4.x

XUL, jQuery.ready, 1.3.2 vs 1.4.x

I have used jQuery successfully in XUL applications for some time.  Recently I updated from using jQuery 1.3.2 to 1.4.2.  This broke behaviors that correspond with the window.onload event.  The following code executes successfully in 1.3.2 but not in 1.4.2:

  1. $( document ).ready( function() {
  2.     alert('test');
  3. } );

This issue originates from the following code within the jQuery.ready function which is present in jQuery 1.4.x but not in 1.3.2:

  1. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  2. if ( !document.body ) {
  3.     return setTimeout( jQuery.ready, 13 );
  4. }
Commenting out these lines of code allow the previously mentioned code to execute properly in both 1.3.2 and 1.4.x.  Obviously XUL typically does not have a "body" element which causes what amounts to an endless loop.  This issue affects only code intended to execute at window load and only when jQuery.ready is used.  Manually setting a window.onload event listener works as expected and jQuery DOM functions executed after window.onload work fine as well.

Is this a known issue when using jQuery with XUL?  Anyone aware of other gotchas I should look out for?  Not sure if this is actually a bug given jQuery doesn't seem to be targeted at XUL.  Thoughts?