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

Close non self-closing, empty tags #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jonprairie
Copy link

All empty HTML tags are currently left open, which is causing issues with script tags in particular. If I link an external script in the head element then due to the resulting non-closed script tag the rest of the document is considered part of the script and not displayed as HTML.

In order to resolve this I included a hash table of Void HTML tags and added a field self-closing-p to the element class that is loaded from this table. When an element is written the system checks if it's empty and not self-closing, if so an associated end tag is included.

I also fixed some typos and tried to smooth out the readme.

jonnyp added 4 commits September 12, 2024 01:03
Tags should close themselves by default unless they are self-closing[1]. An
unclosed script tag in particular, commonly used to include external javascript
files, will eat the rest of the page.

1. List of self-closing tags here:
https://developer.mozilla.org/en-US/docs/Glossary/Void_element
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.

1 participant