Tags incorrectly made self-closing when compiled #29

hesselink opened this Issue Feb 21, 2013 · 1 comment


None yet
2 participants

hesselink commented Feb 21, 2013

Rendering the following template

<a href="${a}"></a>

produces this output:

<a href="${a}" />

According to the HTML5 spec, this means the same as

<a href="${a}">

This has a different meaning, and will break your HTML.

The reason this happens is that in Heist.Compiled.Internal.compileNode, a tag is 'self-closed' like this if it contains no children. This should only be done for tags that must be empty in HTML5, like br and img. In Text.XmlHtml.HTML.Meta, there is a set of voidTags that can be used to check if the tag should be self-closed. However, that module isn't exported (yet), which is why I couldn't easily send a pull request. Should I just expose the module and use that in heist? That's how I fixed it locally.


mightybyte commented Feb 21, 2013

I just made a new hackage release of xmlhtml that exports the Meta module that has voidTags. So yes, I think Heist should use that to do the right thing.

@mightybyte mightybyte closed this Feb 24, 2013

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