Check that `document` is defined
Check that `document` is defined

Check that document is defined before determining browser
capabilities. Otherwise this fails inside a web worker context.

FIX: The package can now be loaded in a web worker context (where
`navigator` is defined but `document` isn't) without crashing.

ProseMirror/prosemirror-view