b-fuze / deno-dom

Browser DOM & HTML parser in Deno
https://jsr.io/@b-fuze/deno-dom
MIT License
423 stars 47 forks source link

TypeError: this[#attrNodeCache][attribute][setAttrValueSym] is not a function #132

Closed Sembiance closed 1 year ago

Sembiance commented 1 year ago

When using deno_dom@v0.1.36-alpha/deno-dom-wasm.ts with deno 1.28.1 and loading the attached welcome.zip file with this code:

import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.36-alpha/deno-dom-wasm.ts";
new DOMParser().parseFromString(await Deno.readTextFile("welcome.html"), "text/html");

causes this error:

error: Uncaught (in promise) TypeError: this[#attrNodeCache][attribute][setAttrValueSym] is not a function
      this.#attrNodeCache[attribute]![setAttrValueSym](value);
                                                      ^
    at NamedNodeMap.<anonymous> (https://deno.land/x/deno_dom@v0.1.36-alpha/src/dom/element.ts:399:55)
    at Element.setAttribute (https://deno.land/x/deno_dom@v0.1.36-alpha/src/dom/element.ts:661:45)
    at new Element (https://deno.land/x/deno_dom@v0.1.36-alpha/src/dom/element.ts:523:12)
    at nodeFromArray (https://deno.land/x/deno_dom@v0.1.36-alpha/src/deserialize.ts:48:15)
    at nodeFromArray (https://deno.land/x/deno_dom@v0.1.36-alpha/src/deserialize.ts:68:9)
    at nodeFromArray (https://deno.land/x/deno_dom@v0.1.36-alpha/src/deserialize.ts:68:9)
    at nodesFromString (https://deno.land/x/deno_dom@v0.1.36-alpha/src/deserialize.ts:11:16)
    at DOMParser.parseFromString (https://deno.land/x/deno_dom@v0.1.36-alpha/src/dom/dom-parser.ts:24:21)
    at file:///tmp/domTest.js:2:17

The same error occurs with latest github version and also with the native variant.

b-fuze commented 1 year ago

Thanks