[whatwg] A tag for measurements / quantity?

Max Romantschuk max at romantschuk.fi
Mon Aug 10 22:58:23 PDT 2009


Hi Everyone,

I've been off the list for quite some time, so bear with me if I missed 
something searching the archives.

I've been looking at the meter element, which specifically states that 
"There is no explicit way to specify units in the meter element, but the 
units may be specified in the title attribute in free-form text."

Having used the web for the past 15 years I've always felt that it's a 
shame when you run into a page with a set of measurements and those 
can't be interpreted automatically in a sensible fashion. Especially 
with the fact that there are both imperial and metric units still around 
in this day and age.

An backwards compatible inline element to specify a quantity would be 
rather trivial:

<quantity unit="cm">12 cm</quantity>
<quantity unit="kg">2 kg</quantity>

With this implementation a number inside the quantity element would be 
interpreted as the numerical value of the unit. Other characters would 
be ignored. That way old browsers would simply ignore the unknown tag, 
whereas a browser aware of this tag could provide DOM hooks for things 
like implementing a browser extension to convert between metric and 
imperial units.

Food for thought. Opinions, anyone?

.max

-- 
        Max Romantschuk
        max at romantschuk.fi
http://max.romantschuk.fi/



More information about the whatwg mailing list