weavejester/hiccup — pull request #63 by pauldorman (2012-09-17 10:39:09+00:00)
Title: Input tags rendered as input elements

This patch allows input elements to be treated like any other tag in Hiccup, with the proviso that they have no content. For example an input of type "password" can be created with the familiar Hiccup form `[:password#someid.someclass.otherclass {:value "foo"}]`.

If there is content the tag gets rendered like any other element. If it wasn't for the HTML "button" element (`Hi, I'm a button`), which is also the name for an HTML input type (``) there would be some cheap opportunities for error handling, but there you go.

This patch does not displace the functions in the hiccup.form namespace (which are unaffected by this change), but may be a step towards deprecating the majority of the functions that create HTML input elements.

Apart from the few lines to implement the change and its tests, there was one change to replace the non-element `

` with `
` in the "empty tags" tests.

Those people keen to use all those fancy HTML5 input types will rejoice I'm sure! ;)