-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser: Handle self-closing elements and void elements (#127)
- 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
- Loading branch information
Showing
3 changed files
with
68 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters