The Case For a Unit Tag
This morning I had a short twitter conversation with Bruce Lawson regarding a possibly useful HTML5 tag: the <unit> tag. This tweet prompted a thought. If <time> could be better described through the use of an attribute, such as <time type="datetime"> or similar, then I think there could be room for a <unit> tag that could be defined by its own attribute.
Ian Hickson, while responding to the whole <time> tag retraction and re-addition to the spec, proposed additional tags such as <geo> and <scalar>.
One problem with <scalar> is that it refers to units only by their magnitude and not direction. If we want to use <scalar>, we would probably want a <vector> tag inducted down the road to even it out. Secondly, what does <scalar> mean to non-math types? Not a whole lot until they find out what the word "scalar" even means. If tags are to describe their contents, why use a cloudy term such as "scalar?"
Here, I feel that <unit> could mean more to non-math types as well as being more flexible. <unit> doesn't care about dimension, so points, distance, direction, and volume could all be valid types of units. In fact, it could take the place of <time> in some cases. <unit type="minute"> makes sense, or even a more generic <unit type="time"> would fill that need.
The Attributes
Here are a couple attribute examples that would help better define <unit>:
- meter
- foot
- square-feet
- acre
- mile
- torque
- deg-farenheit
- deg-celsius
- hour
- minute
- second
- milisecond
- gram
- ounce
- pound
... and so on.
I think HTML5 could be better served with a <unit> tag.