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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
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