import type { GlobalConfig, UrlString, FrameElement } from '../types'; import { DomResource } from './dom-resource'; /** * DomCloneResource represents an HTML document, but works on a clone of the DOM it was given. * * It allows a web page to be snapshotted in its current state, after which modifications to the * original DOM or the clone do not influence the other. * * The original document is cloned at construction time. Its frames can be (recursively) cloned * with {@link cloneFramedDocs}. * * See its parent class {@link DomResource} for further info. * * @example * const domResource = new DomCloneResource(window.document) * domResource.cloneFramedDocs(true) * * @category Resources */ export declare class DomCloneResource extends DomResource { private _framesContentDocClones; private _originalDoc; /** * @param originalDoc - The Document to clone. * @param url - Since the passed Document already has a property `doc.URL`, the `url` parameter * is optional; if passed it will override the value of `doc.URL` when determining the target of * relative URLs. * @param config - Optional environment configuration. */ constructor(originalDoc: Document, url?: UrlString, config?: GlobalConfig); /** * The clone of the Document. */ get doc(): Document; /** * The Document that was cloned. */ get originalDoc(): Document; /** * Get the original node corresponding to a given node in the document clone. */ getOriginalNode(nodeInClone: T): T; /** * Get the cloned node corresponding to a given node in the original document. */ getClonedNode(nodeInOriginal: T): T; /** * Create a DomCloneResource for each document in an (i)frame in the original document. * * The created clones are associated with the (i)frame elements. To access a clone, use * {@link getContentDocOfFrame}. * * @param deep - If `true`, also clone any frames inside the frames, recursively. */ cloneFramedDocs(deep?: boolean): void; /** * Get the clone of the framed Document for a given (i)frame element. * * As cloning a DOM does not clone the documents inside its frames (the `contentDocument` of a * frame in the cloned resource is null), this method lets you obtain a clone of the framed * document. * * On the first invocation, the frame content is cloned from the original document. Subsequent * invocations will return this same object. * * @param frameElement The frame element for which to get the inner document. Either the frame * of the original or of the cloned document can be passed. * @returns A clone of the document in the frame. */ getContentDocOfFrame(frameElement: FrameElement): DomCloneResource | null; private _getContentDocOfFrame; }