getWindow.js 261 B

123456789
  1. /**
  2. * Get the window associated with the element
  3. * @argument {Element} element
  4. * @returns {Window}
  5. */
  6. export default function getWindow(element) {
  7. const ownerDocument = element.ownerDocument;
  8. return ownerDocument ? ownerDocument.defaultView : window;
  9. }