Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

JSDOM works on Deno. Here's a script:

  // from https://gist.github.com/kt3k/6123515ff5d1e167f82dfe4aa12ee5d9
  import { JSDOM } from "https://jspm.dev/jsdom";
  const doc = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
  console.log(doc.window.document.querySelector("p").textContent);
Run it like this:

  deno run 'https://gist.githubusercontent.com/kt3k/6123515ff5d1e167f82dfe4aa12ee5d9/raw/f27520c629e56ab6e53e411c455ecc289300bb28/jsdom-in-deno.ts'
This returns "Hello world" on my machine, deno 2.3.1

I'd need more info about your problem but I'm not convinced that Deno's the problem and if there is one.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: