Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Tags incorrectly made self-closing when compiled #29

Closed
hesselink opened this Issue · 1 comment

2 participants

Erik Hesselink Doug Beardsley
Erik Hesselink

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.

Doug Beardsley
Owner

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.

Doug Beardsley mightybyte closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.