getDocumentWindow
Gets the window a document belongs to.
A document is the one node whose ownerDocument is null, so the ownerDocument-chasing lookup used for ordinary nodes resolves a document to the wrong window. Reading defaultView off the document itself is what keeps a pop-out window’s coordinates measured against that window.
Import:
import { getDocumentWindow } from 'obsidian-dev-utils/html-element';Signature:
function getDocumentWindow(doc: Document): WindowParameters:
| Parameter | Type | Description |
|---|---|---|
doc | Document | The document to get the window of. |
Returns: Window — The window the document belongs to.