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

Correctly parse self-closing HTML tags per the spec #126

Open
paulsmith opened this issue Apr 4, 2024 · 1 comment · May be fixed by #127
Open

Correctly parse self-closing HTML tags per the spec #126

paulsmith opened this issue Apr 4, 2024 · 1 comment · May be fixed by #127
Assignees
Labels
bug Something isn't working

Comments

@paulsmith
Copy link
Contributor

See Svelte

More

@paulsmith paulsmith added the bug Something isn't working label Apr 4, 2024
@paulsmith paulsmith self-assigned this Apr 4, 2024
@paulsmith
Copy link
Contributor Author

paulsmith commented Apr 4, 2024

paulsmith added a commit that referenced this issue Apr 4, 2024
- 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
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant