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

Add support for Element.firstElementChild property #328

Open
piranna opened this issue Oct 2, 2021 · 5 comments · May be fixed by #398
Open

Add support for Element.firstElementChild property #328

piranna opened this issue Oct 2, 2021 · 5 comments · May be fixed by #398
Labels
help-wanted External contributions welcome spec:HTML types Anything regarding Typescript

Comments

@piranna
Copy link

piranna commented Oct 2, 2021

https://developer.mozilla.org/en-US/docs/Web/API/Element/firstElementChild

The Element.firstElementChild read-only property returns an element's first child Element, or null if there are no child elements.

Element.firstElementChild includes only element nodes. xmldom only implements Node.firstChild, that return all the child nodes, including non-element nodes like text and comment nodes.

@karfau karfau added spec:HTML types Anything regarding Typescript labels Oct 2, 2021
@karfau karfau added this to the planning 1.0.0 milestone Oct 2, 2021
@karfau
Copy link
Member

karfau commented Oct 2, 2021

I guess when talking about one method in this realm, it would mean that people would also expect lastElementChild, childElementCount, nextElementSibling, previousElementSibling to be available. And maybe even getElementsBy... methods.

It will not be the highest priority by the maintainers, but it will also not be rejected.

It's related to the discussion regarding supporting more things from the living standard #176 and also regarding providing the correct actual types #285 instead of relying on the ones from typescript.

@karfau karfau added the help-wanted External contributions welcome label Oct 2, 2021
@piranna
Copy link
Author

piranna commented Oct 3, 2021

Yes, ideally it should implement the other Element class APIs, too.

@KevinYeramian
Copy link

Hey @karfau,
I would be very interested to work on this. The issue is quite old, is it something that is still "not rejected" by the maintainers?

@karfau
Copy link
Member

karfau commented Apr 6, 2022

@KevinYeramian anything that is aligned with the spec and is not requiring major rewrites or new dependencies is always welcome.

You can always expect feedback and suggestions how to improve the contribution, but most likely no substantial code contributions by maintainers.
And we will expect unit tests for every new API including those for edge cases.
Ideally you can provide small chunks of changes/multiple focused PRs, so reviewing each is easier for us.
In this case maybe adding useful pairs of APIs.

@KevinYeramian
Copy link

@karfau thank you for the answer.

I just create the PR #398.

@karfau karfau linked a pull request Apr 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted External contributions welcome spec:HTML types Anything regarding Typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants