How to use the @hint/utils-dom.restoreReferences function in @hint/utils-dom

To help you get started, we’ve selected a few @hint/utils-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webhintio / hint / packages / extension-browser / src / content-script / connector.ts View on Github external
setTimeout(async () => {
                try {
                    await this.evaluateInPage(`(${createHelpers})()`);

                    const snapshot: DocumentData = await this.evaluateInPage('__webhint.snapshotDocument(document)');

                    restoreReferences(snapshot);

                    this._document = new HTMLDocument(snapshot, location.href, this._originalDocument);

                    await this.sendFetchEndEvents();

                    await traverse(this._document, this._engine, resource);

                    /*
                     * Evaluate after the traversing, just in case something goes wrong
                     * in any of the evaluation and some scripts are left in the DOM.
                     */
                    const event = {
                        document: this._document,
                        resource
                    };
github webhintio / hint / packages / parser-jsx / src / parser.ts View on Github external
const createHTMLFragment = (roots: RootMap, resource: string) => {
    const dom = parse5.parse(
        ``,
        { treeAdapter: htmlparser2Adapter }
    ) as DocumentData;

    const body = (dom.children[1] as ElementData).children[1] as ElementData;

    roots.forEach((root) => {
        body.children.push(root);
    });

    restoreReferences(dom);

    return new HTMLDocument(dom, resource);
};