Pull requests

#16 Merged
Repository
jvanasco jvanasco
Branch
default
Repository
formencode formencode
Branch
default

support removing </form:error> tags. makes formencode friendlier with html5 libraries

Author
  1. jvanasco
Reviewers
Description

Not all tags are allows to be self-closing in html5. I've run into errors with browsers / css libraries failing on having a self-closing <form:error/> tag.

this patch simply allows you to instead write errors as: <form:error></form:error>

it makes browsers happier.

Comments (5)

    1. jvanasco author

      Do you know which browsers have the issue?

      Basically "all of them". The problem with creating a test-case is that it depends on how much css and html you have. They're largely forgiving, but not entirely forgiving.

      On the html5 spec, only a subset of tags - void , svg, and math - are allowed to be self-closing. The rest are expected to close. [ http://www.w3.org/TR/html5/syntax.html#void-elements ]

      You can usually trip the html error with a <form:error/> or even an <iframe/> or any other unapproved-for-self-closing tag.

      An easy way to see what happens is to download the twitter-bootstrap library ( http://twitter.github.com ) along with the 'docs' -- and insert a self-closing <iframe /> tag about 2/3 down one of the lengthier pages. That should cause Safari and Firefox to both choke and stop rendering the page. It's been hit&miss for me on recreating it with a form:error tag - I think it just happens to be a function of the specific browser release version and the complexity of the underlying html/css.

      In any event, the issue is that (according to the specs) while <form:error /> is valid for XHTML it is invalid for HTML5 . <form:error></form:error> should work on both.

      This is only an issue if you're not parsing the original state of the form with htmlfill , or if you're having a front-end team mark up standalone html pages before passing off to the backend -- but it can pop up.

    1. jvanasco author

      No additional tests fail - but a lot of tests were already failing on what I pulled.

      I'll fork on github and work off that one!