Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a.pathname is undefined #147

Open
5d-jh opened this issue Oct 17, 2023 · 2 comments
Open

a.pathname is undefined #147

5d-jh opened this issue Oct 17, 2023 · 2 comments

Comments

@5d-jh
Copy link

5d-jh commented Oct 17, 2023

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
@5d-jh 5d-jh changed the title pathname in a element is undefined a.pathname is undefined Oct 17, 2023
@b-fuze
Copy link
Owner

b-fuze commented Oct 17, 2023

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

@chaosharmonic
Copy link

This is kind of out of my depth, but it turns out JSDOM has something for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants