Module

x/deno_dom/deno-dom-wasm-noinit.ts

Browser DOM & HTML parser in Deno
Extremely Popular
Latest
import * as mod from "https://dotland.deno.dev/x/deno_dom@v0.1.48/deno-dom-wasm-noinit.ts";

Examples

Example 1

import { DOMParser, initParser } from "jsr:@b-fuze/deno-dom/wasm-noinit";

// ...and when you need Deno DOM's parser make sure you initialize it...
await initParser();

// Then you can use Deno DOM as you would normally
const doc = new DOMParser().parseFromString(
  `
    <h1>Hello World!</h1>
    <p>Hello from <a href="https://deno.land/">Deno!</a></p>
  `,
  "text/html",
);

const p = doc.querySelector("p")!;
console.log(p.textContent); // "Hello from Deno!"

Functions

Explicitly disable querySelector/All code generation with the Function constructor forcing the Sizzle engine. Enables those APIs on platforms like Deno Deploy that don't allow code generation.

Throws if any of the nodes are an ancestor of parentNode