Files
notesnook/packages/core/utils/html-parser.js
2021-12-08 19:32:58 +05:00

12 lines
361 B
JavaScript

import { parse } from "node-html-parser";
export const parseHTML =
typeof DOMParser === "undefined"
? (input) => parse(input)
: (input) => new DOMParser().parseFromString(input, "text/html");
export function getDummyDocument() {
const doc = parseHTML("<div></div>");
return typeof DOMParser === "undefined" ? doc : doc.body.firstElementChild;
}