[whatwg] Form input element for value-unit pairs

Christoph Päper christoph.paeper at crissov.de
Mon Mar 14 11:37:43 PDT 2011


Christoph Päper (2011-03-05):

> Thus, would it make sense to add another new type for the ‘input’ element?

A new type is probably not necessary, because a new attribute that is called something like ‘unit’ and is only valid in the ‘number’ and ‘range’ states could be enough. 

  <input type="number" id="fontsize" value="12" unit="pt">

This solution would be perfectly backwards compatible, because non-supporting UAs simply wouldn’t use, change and transmit ‘unit’ and therefore the server can safely assume the default.

I’m not sure, though, how UAs are supposed to know which other units could be substituted – standard abbreviations perhaps: reference CSS3 Values or SI / ISO/IEC 80000.

<http://www.whatwg.org/specs/web-apps/current-work/multipage/number-state.html>


More information about the whatwg mailing list