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

Improve handling of self-closing syntax #254

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

Conversation

kornelski
Copy link
Contributor

In HTML (and XHTML sent as text/html), <foo /> is not closed, and is functionally identical to <foo>. In HTML content /> is a syntax error on non-void elements, and a useless talisman on void elements.

Authors used to XML or JSX find it hard to believe, so I've updated the documentation to reiterate this fact.

Additionally, if content is added to an element with the /> syntax error, the invalid / will be removed to avoid surprising users with <foo/>content</foo>.

The library still preserves the /> syntax in other cases, even when it's useless or invalid, to keep syntax consistent with non-rewritten content (where it wouldn't be changed), and out of caution in case our parser gets out of sync with SVG/MathML namespace.

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