Closed kemiller closed 9 months ago
Can you share the HTML that caused that error
I got the same issue
import { DOMParser } from "jsr:@b-fuze/deno-dom";
let text = response.text();
const response = await fetch("https://golem.de")
const doc = new DOMParser().parseFromString(text, "text/html")
error: Uncaught (in promise) RuntimeError: memory access out of bounds at dlmalloc::dlmalloc::Chunk::size::hc1c6ee1862ed3f63 (wasm://wasm/00257616:1:269921) at rdl_realloc (wasm://wasm/00257616:1:156715) at __rust_realloc (wasm://wasm/00257616:1:268867) at wbindgen_realloc (wasm://wasm/00257616:1:267789) at passStringToWasm0 (https://jsr.io/@b-fuze/deno-dom/0.1.47/build/deno-wasm/deno-wasm.js:57:11) at parse (https://jsr.io/@b-fuze/deno-dom/0.1.47/build/deno-wasm/deno-wasm.js:96:16) at nodesFromString (https://jsr.io/@b-fuze/deno-dom/0.1.47/src/deserialize.ts:10:29) at DOMParser.parseFromString (https://jsr.io/@b-fuze/deno-dom/0.1.47/src/dom/dom-parser.ts:24:21)
@Robert-Ernst your code looks a bit incorrect so I fixed it and couldn't reproduce, it works for me:
import { DOMParser } from "jsr:@b-fuze/deno-dom";
const response = await fetch("https://golem.de")
const text = await response.text();
const doc = new DOMParser().parseFromString(text, "text/html")!;
console.log(doc.querySelectorAll("*").length);
console.log(doc.documentElement?.outerHTML);
what platform are you using and which version of Deno?
Trying to do a pretty simple HTML parse, and get WASM error:
Offending line is just this:
Is there anything special I should be doing differently or is this a bug?