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

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

Commits on Apr 4, 2024

  1. parser: Handle self-closing elements and void elements

    - 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 committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    8da1e80 View commit details
    Browse the repository at this point in the history