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

feat: Add traversal methods to Element #398

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

KevinYeramian
Copy link

What does this PR do?

  • Add traversal methods to Element

I used the word traversal because it used in the official documentation to refers to these methods (link)

test/dom/element.test.js Outdated Show resolved Hide resolved
lib/dom.js Outdated Show resolved Hide resolved
lib/dom.js Outdated Show resolved Hide resolved
Copy link
Member

@karfau karfau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method _insertBefore is calling the remove method but has extra code for joining inserting a child into the NodeList, can you please check if something also needs to be added there?

@karfau
Copy link
Member

karfau commented Apr 6, 2022

We also need some documentation:

  • listing them in the readme as part of the section of the spec that first introduced them.
  • jsdoc comments on the properties with minimal description taken from the spec, pointing to any differences from the spec.
    And ideally I would prefer to mark those properties as @readonly in a "tsdoc" comment way (you should be able to find other examples in the code base), to get a bit closer to having getters instead of normal properties.

@karfau
Copy link
Member

karfau commented Apr 6, 2022

Thank you a lot for the contribution so far.
I provided some feedback that needs to be addressed, but it seems to be a much smaller effort than I originally anticipated.

@karfau karfau linked an issue Apr 6, 2022 that may be closed by this pull request
@KevinYeramian
Copy link
Author

KevinYeramian commented Apr 7, 2022

Review fixes committed!

  • Not sure what to check for your comment
  • I added the "tsdoc" but it current format seems little bit “heavy" in the code.

readme.md Show resolved Hide resolved
@karfau
Copy link
Member

karfau commented Apr 9, 2022

Review fixes committed!

Nice, loving it so far

  • Not sure what to check for your comment

Yeah, that comment is a bit hard to grasp, sorry.
I think we are missing updating the new props as part of the Node.insertBefore API, which is also used as part of other methods:
https://github.com/brodybits/xmldom/blob/c234c4d08b482841886b703547dd62697e6d863d/lib/dom.js#L448-L462

  • I added the "tsdoc" but it current format seems little bit “heavy" in the code.

Looks great for me.

@karfau karfau added help-wanted External contributions welcome testing types Anything regarding Typescript spec:HTML labels Oct 8, 2022
@karfau
Copy link
Member

karfau commented Oct 16, 2022

The method _insertBefore is calling the remove method but has extra code for joining inserting a child into the NodeList, can you please check if something also needs to be added there?

@KevinYeramian This comment points to my main concern for this PR so far. Do you still have capacity to continue working on it? I can help to relsove the conflicts if that's an issue for you.

# Conflicts:
#	lib/dom.js
#	test/dom/element.test.js
@karfau
Copy link
Member

karfau commented Sep 28, 2023

I resolved the commit, which leads to failing tests (due to the breaking changes in version 9.
I will see if I find time to get back to it, but it just didn't feel right to close the PR.

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 testing types Anything regarding Typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Element.firstElementChild property
2 participants