Skip to content

Support JSDOM (with DOMPurify) #2

@jonasheschl

Description

@jonasheschl

Currently the DOMPurify pipe will always run its purification using the browser. It would be useful to have an option in the DOMPurify pipe to use JSDom instead.

In addition, while there is a pipe for parse5, there is no pipe for JSDom. Even though JSDom uses parse5, it can sometimes exhibit parsing differentials to parse5 itself.

The pipe for JSDom could look something like this, where HTML_STRING is the HTML to be parsed.

import { JSDOM } from "jsdom";

const window = new JSDOM(HTML_STRING).window;

console.log(window.document.documentElement.innerHTML)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions