code: function getWindowForElement(element) {
    const e = element.documentElement || element;
    const doc = e.ownerDocument;
    return doc.defaultView;
  }
docs: Gets the window object from a given element or document
  
  @private
  @param {!HTMLDocument|HTMLElement} element The element to get the window object for
  @return {Window|null} the window object for the given element