You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

15 lines
420 B

// @flow
import { isElement } from './instanceOf';
import type { Window } from '../types';
export default function getDocumentElement(
element: Element | Window
): HTMLElement {
// $FlowFixMe[incompatible-return]: assume body is always available
return (
(isElement(element)
? element.ownerDocument
: // $FlowFixMe[prop-missing]
element.document) || window.document
).documentElement;
}