Handle situation where `document` is set to `null` by an environment.
Handle situation where `document` is set to `null` by an environment.

jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab