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

Implement more getters and methods on HTMLElement, in accordance with the DOM spec #281

Merged
merged 5 commits into from
Nov 14, 2024

Conversation

Maluscat
Copy link

Hi,
First of all, thanks for writing this library, it's a really clever yet simple DOM abstraction!

I implemented some methods that I felt were missing from the HTMLElement. They are commonly used in the actual DOM and thus provide better compatibility with other backend DOM abstractions as well (in my case, I switched from deno-dom to node-html-parser, and I had to shim some of these).

  • get children() (only HTMLElement children)
  • get firstElementChild()
  • get lastElementchild()
  • get childElementCount()
  • before(...nodes)
  • after(...nodes)
  • prepend(...nodes)
  • append(...nodes)

The last four are now the base operations. insertAdjacentHTML and appendChild use them and they are tested accordingly.

README documentation is also included ✌️

@taoqf taoqf merged commit d903da2 into taoqf:main Nov 14, 2024
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

Successfully merging this pull request may close these issues.

2 participants