/** * Mounts the cloned document into a hidden iframe and waits for it to become * paintable. * * Extracted from DocumentCloner so the cloner only owns node-cloning strategy; * this module owns the iframe lifecycle: container creation, document.write, * Trusted Types, load polling, webfont/image readiness, the onclone hook and * WebKit scroll-anchoring compensation. */ import { Bounds } from '../css/layout/bounds'; import { Context } from '../core/context'; export interface CloneMountOptions { /** Cloned root to adopt into the iframe document. */ documentElement: HTMLElement; /** Clone of the render target; must exist before mounting. */ clonedReferenceElement: HTMLElement | undefined; /** nodeName of the original render target, for error messages. */ referenceElementName: string; /** [clonedNode, scrollLeft, scrollTop] pairs captured during cloning. */ scrolledElements: [Element, number, number][]; /** Consumer hook, invoked with the cloned document before measuring. */ onclone?: (document: Document, element: HTMLElement) => void; /** Mount the iframe inside a shadow root instead of
. */ container?: HTMLElement | ShadowRoot; /** * Aborting rejects the mount (iframe poll, font/image waits) with an * AbortError instead of waiting out the readiness windows. */ signal?: AbortSignal; } type TrustedTypePolicyLike = { createHTML: (s: string) => string; }; /** * Resolve the Trusted Types policy used for writing the clone document. * Returns null when Trusted Types are unavailable or the policy could not be * created — document.write is not a Trusted Types sink, so the plain string * stays functional in both cases. * @internal – exported for testing only. */ export declare const resolveTrustedTypesPolicy: (ownerWindow: Window | null) => TrustedTypePolicyLike | null; export declare const createIFrameContainer: (ownerDocument: Document, bounds: Bounds, customContainer?: HTMLElement | ShadowRoot) => HTMLIFrameElement; /** * Serialise a document type declaration to an HTML string. * @internal – exported for testing only, not part of the public API. */ export declare const serializeDoctype: (doctype?: DocumentType | null) => string; /** * Point the clone's relative URLs at the source document. * @internal – exported for testing only, not part of the public API. */ export declare const addBase: (targetELement: HTMLElement, baseUri: string) => void; export declare const mountCloneInIFrame: (context: Context, ownerDocument: Document, windowSize: Bounds, mount: CloneMountOptions) => Promise