[Ur] Patch, more html5 attributes

Adam Chlipala adamc at csail.mit.edu
Sun Nov 16 15:26:13 EST 2014


Thanks for the patch!  I've incorporated it and made some small changes, 
as noted below.

On 10/12/2014 07:58 AM, Sergey Mironov wrote:
> First thing I need was HTML5 attributes 'required' and 'autofocus' for input
> fields. Those changes are located in basis.urs and are rather straightforward.

I've changed both to be type [bool] instead of [string], and I added an 
Ur/Web parsing extension to allow the usual HTML syntax, without having 
to provide a value for the attribute.

I also undid your addition of attribute 'value' for checkboxes. That 
attribute breaks the Ur/Web abstraction of a checkbox as generating a 
Boolean value; it's nonsensical to allow assigning a string value.  Some 
real-world use cases of checkbox 'value' might come from having multiple 
checkboxes in one form with the same name, but the Ur/Web standard 
library currently rules out duplicate checkbox names at compile time!

> The second thing is the <input type='email'/>. My intuition says me that adding
> custom input types was not designed to be regular operation, but building recent
> HTML5 pages may require doing it. Quick search [2] shows that there are 'url'
> 'tel', 'search', 'number', 'range', 'date', etc. I included the monoize.sml
> change to support just the [email] for ordinary [formTags].  Is it possible to
> prepare a procedure of doing the same thing for [cformTags] (references to
> javaScript confuse me)?

I've now added old-school and AJAX versions of all the new HTML5 widgets 
that I learned about.  I'll be interested to know what you think of the 
interface.



More information about the Ur mailing list