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

DOMTokenList is not indexable #95

Closed
Masamune903 opened this issue May 9, 2022 · 3 comments
Closed

DOMTokenList is not indexable #95

Masamune903 opened this issue May 9, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@Masamune903
Copy link

As for some elements, elem.querySelectorAll doesn't work. When I check instantly, in function makeRef(selectors, element) at "/src/dom/selectors/nwsapi.js" and line 1328, element.classList[0] is used. element.classList is an instance of DOMTokenList and DOMTokenList extends Set, so we cannot get items as ".classList[0]". A native DOMTokenList acts as an Array so I want you to fix DOMTokenList.

I'm a Japanese student, so my sentence is so bad. I apologize.

@0kku
Copy link
Collaborator

0kku commented May 9, 2022

おつかれさまでした。Your English is fine.

So; it sounds like you're reporting two issues:

  1. What should be a DomTokenList is not indexable in deno-dom:
const doc = new DOMParser().parseFromString("<div class='foo bar'></div>", "text/html");
doc.querySelector("div").classList[0]; // should return "foo" but returns undefined
  1. The :scope pseudo-class selector is not supported:
doc.querySelector(":scope"); // should return <html> element of the document, but returns null

@0kku
Copy link
Collaborator

0kku commented May 10, 2022

#96 will address the first issue once it's ready for merging.

I created a new issue for the second problem: #97.

@0kku 0kku changed the title querySelectoAll(":scope") doesn't work (classList extends Set but accessed like "classList[0]") DOMTokenList is not indexable May 10, 2022
@0kku 0kku self-assigned this May 10, 2022
@0kku 0kku added the enhancement New feature or request label May 10, 2022
@b-fuze b-fuze closed this as completed in fce2f05 May 12, 2022
@b-fuze
Copy link
Owner

b-fuze commented May 12, 2022

Thanks to @0kku DOMTokenList is fixed, however :scope is still broken due to a bug in the upstream dependency, nwsapi... Which is being tracked in #97

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

No branches or pull requests

3 participants