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

Fix sxml.serializer generating broken html #322

Merged
merged 3 commits into from Nov 25, 2017

Conversation

Projects
None yet
2 participants
@pclouds
Contributor

pclouds commented Nov 24, 2017

HTML5 (which basically is all modern browsers nowadays) seems to have a slightly different HTML syntax than html4. Things like "" will not be considered equivalent to "", just "" but that is what we generate. As a result, the output html code could be rendered completely broken.

This attempts to fix that (in my own clumsy way because I haven't spent that much time studying this code). I know this is imported code but I don't know exactly how you want to handle this, maybe deal with upstream first, then import changes back?

pclouds added some commits Nov 24, 2017

sxml: do not end html5 empty tags with "/>"
HTML5 does not seem to accept all tags ending with "/>" like XML (or
HTML4) [1]. Those of "void elements" will accept and ignore the
"/". Foreign tags (MathML and SVG) do recognize that. For other tags, it
seems ignored as well and result tags remain open.

The code is updated so that we still leave void elements open (which is
fine; closing tags are optional for them). Otherwise, we immediately
close the tag.

[1] https://www.w3.org/TR/html5/syntax.html#start-tags
@shirok

This comment has been minimized.

Owner

shirok commented Nov 25, 2017

Thanks. Ideally we send it to upstream, but I'm not sure the development activity of the upstream. I'll apply it now and will figure out that later.

@shirok shirok merged commit 060befc into shirok:master Nov 25, 2017

@pclouds pclouds deleted the pclouds:sxml-html5-serializer branch Dec 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment