code: function windowSizeReady ( queriedWindow, readyDfd, interval ) {
  
      if ( !varExists( $ ) ) throw new Error( "This method uses jQuery deferreds, but the $ variable is not available" );
  
      if ( queriedWindow instanceof $ ) queriedWindow = queriedWindow[0];
  
      readyDfd || ( readyDfd = $.Deferred() );
  
      $( queriedWindow.document ).ready( function () {
  
          var documentElement = queriedWindow.document.documentElement,
              lastSize = { width: documentElement.clientWidth, height: documentElement.clientHeight },
  
              repeater = setInterval( function () {
  
                  var width = documentElement.clientWidth,
                      height = documentElement.clientHeight,
                      isStable = width > 0 && height > 0 && width === lastSize.width && height === lastSize.height;
  
                  if ( isStable ) {
                      clearInterval( repeater );
                      readyDfd.resolve();
                  } else {
                      lastSize = { width: width, height: height };
                  }
  
              }, interval || 100 );
  
      } );
  
      return readyDfd;
  
  }
docs: Waits for the size of a window to become stable, in case it is undergoing a change. Returns a deferred which resolves
  when the window size is stable.
  
  Optionally accepts an external jQuery deferred to act on, which is then returned instead.
  
  This check can be used to determine when the process of resizing a window has ended. It should also be used when a
  new window is created.
  
  Technique
  ---------
  
  In most cases, it would be enough to set a timeout of 0 and then resolve the deferred. The timeout frees the UI and
  allows the window to assume its eventual size before the deferred is resolved.
  
  Unfortunately, the success rate of this approach is close to, but not quite, 100%. So instead, we check the reported
  window size in regular intervals, so we know for sure when it is stable.
  
  @param {Window|jQuery}   queriedWindow   the window to observe, also accepted inside a jQuery `$( window )` wrapper
  @param {jQuery.Deferred} [readyDfd]
  @param {number}          [interval=100]  the interval for checking the window size, in ms
  
  @returns {jQuery.Deferred}