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

`a.pathname` is undefined #147

Open 5d-jh opened 1 year ago

5d-jh commented 1 year ago

pathname field is undefined when create an a element. I expected empty string.

import { DOMParser } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts";

const document = new DOMParser().parseFromString(
  "<!DOCTYPE html><html></html>",
  "text/html"
);

const a = document.createElement('a')
console.log(a.pathname); // on browser(chrome): '', on deno-dom: undefined
b-fuze commented 1 year ago

Yeah, that's an HTMLAnchorElement specific property—a subclass of HTMLElement—but deno-dom has only implemented its parent class HTMLElement. When I get some time I'll go and implement the various subclasses including HTMLAnchorElement

Ideally I'd like to maybe automatically generate them from Web IDL... Gotta look into that