pseudo-dom
    Preparing search index...

    Function installGlobal

    • When there is no real DOM already available (a real browser, or a jsdom-based test environment - isBrowser is true for both, since jsdom's window has a document too, and a jsdom document should never be overwritten, real DOM behaviour is always closer to the real thing), populate the given global-like target with document / Node / Element / HTMLElement / HTMLDocument, generated by generateDocument, plus window (a self-reference, matching a real browser's global scope - some code checks for a bare window before falling back to global), so code written against a real DOM's globals works as-is. Does nothing when a real DOM is already there, matching generateDocument's own only-fill-what-is-missing behaviour - calling this is always safe, in any environment.

      Parameters

      • target: any = ...

        The object to add document / Node / Element / HTMLElement / window onto - defaults to globalThis, so bare document, Node, window, etc. resolve from anywhere once this has run

      Returns any

      The same target, for convenience