function ownerDocument(node) {
  return (node ? node.ownerDocument : null) || document;
}
Returns the document owner of the given element. In particular,
returns window.document if node is null or the browser does not
support ownerDocument.

@param {Node} node  The node whose ownerDocument is required.
@returns {Document|Null}  The owner document or null if unsupported.