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

parser: Handle self-closing elements and void elements #127

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Conversation

paulsmith
Copy link
Contributor

  • Add selfClosing field to nodeElement struct to track self-closing tags
  • Update match function to accept multiple token types
  • Check for self-closing tags in parseElement and set selfClosing field
  • Return early for void elements in parseElement
  • Refactor parseChildren to handle both start and self-closing tags
  • Add isVoidElement function to check if a tag is a void element
  • Update tests to cover self-closing and void elements

🌟 These changes improve the HTML parser to properly handle self-closing elements and void elements according to the HTML spec.

Fixes #126

- Add `selfClosing` field to `nodeElement` struct to track self-closing tags
- Update `match` function to accept multiple token types
- Check for self-closing tags in `parseElement` and set `selfClosing` field
- Return early for void elements in `parseElement`
- Refactor `parseChildren` to handle both start and self-closing tags
- Add `isVoidElement` function to check if a tag is a void element
- Update tests to cover self-closing and void elements

🌟 These changes improve the HTML parser to properly handle self-closing
elements and void elements according to the HTML spec.

Fixes #126
@paulsmith paulsmith merged commit 530852a into main Oct 11, 2024
2 checks passed
@paulsmith paulsmith deleted the issues/126 branch October 11, 2024 02:17
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.

Correctly parse self-closing HTML tags per the spec
1 participant