code: function getWindow(node) {
    if (isWindow(node)) {
      return node;
    }
  
    var doc = getDocument(node);
  
    if (needsIEFallback) {
      // In IE 6-8, only the variable 'window' can be used to connect events (others
      // may be only copies).
      doc.parentWindow.execScript('document._parentWindow = window;', 'Javascript');
      var win = doc._parentWindow;
      // to prevent memory leak, unset it after use
      // another possibility is to add an onUnload handler,
      // (which seems overkill to @liucougar)
      doc._parentWindow = null;
      return win;
    } else {
      // standards-compliant and newer IE
      return doc.defaultView || doc.parentWindow;
    }
  }
docs: Returns the `window` object associated with the given `node`, which may be
  a DOM element, the Window object, a Selection, a Range. Basically any DOM
  object that references the Window in some way, this function will find it.
  
  @param {Mixed} node - DOM node, selection, or range in which to find the `window` object
  @return {Window} the `window` object associated with `node`
  @public