[whatwg] simple numbers

Ian Hickson ian at hixie.ch
Mon Dec 10 21:20:54 PST 2007



I considered all the feedback on having a <number> element (or similar), 
quoted below.

While I think there is certainly something to be said for the proposal, I 
don't think there is enough evidence that authors really want or need 
this. I think we should focus on having CSS support this first.

Thanks for the feedback, though.


On Tue, 6 Jun 2006, Keryx webb wrote:
> 
> I have personally (and currently) no need to write any advanced 
> mathematical formulas, but would like to have simple but large numbers 
> formatted in an usable and accessible way.
> 
> If I write 54367534196.143 it is hard to read. In English this would be 
> easier for most users:
> 54,367,534,196.143
> 
> In Swedish we write it this way:
> 54 367 534 196,143
> 
> However, there are two problems.
> 
> 1. The number might be split across two lines (bad usability):
> ... yadda yadda yadda 54 367
> 534 196.143
> 
> 2. The number will not be spoken correctly using speech synthesis (bad 
> accessibility for some). Instead of "54 billion 367 million 534 thousand 
> 196 point 143" it would probably say:
>
> 54
> 367
> 534
> 196,143
> 
> The first problem is easily remedied. Wrap in a span and apply CSS 
> "white-space: nowrap" or (not quite as elegant) use non-breaking space.
> 
> There are issues also with i18n. What is needed is some CSS rule that 
> can be used in a similar fashion to XSLT's format-number() or (dare I 
> say it) mso-number-format. If UAs knew that they dealt with a number, 
> they might infer from the current language what separates decimals from 
> integers. Using selectors for language and mediaspecific styles we could 
> have numbers easily readable for all sighted users and easily understood 
> by blind users as well.

On Tue, 6 Jun 2006, Michel Fortin wrote:
> 
> Have you tried using unbreakable spaces instead?
> 
>     123&nbsp;456&nbsp;789,12
> 
> I'm curious to know if a screen reader can read that correctly.
> 
>  - - -
> 
> Maybe a number element would be valuable, both inside and outside 
> formulas, to provide format-neutral machine-readable numeric values:
> 
>     <n value="123456789.12">123 456 789,12</n>
> 
> But it surly seems a little overkill to write each numeric value twice. 
> Duplicating values seems prone to errors. So maybe a number with a 
> decimal separator attribute would be a better approach:
> 
>     <n dec=",">123 456 789,12</n>
> 
> Beside that, it could provide data on other kinds of numbers too:
> 
>     <n base="16">329F 2CA0</n>

On Wed, 7 Jun 2006, Mihai Sucan wrote:
> 
> I'd look for a solution via CSS. It is not possible today, but I'd say 
> this would be a welcome addition.
> 
> I like the idea Michel came up with. However, with a few changes. Yes, 
> the value attribute would be overkill.
> 
> Similar to the way you can define quotes in CSS, I'd wish we could be 
> able to define number format.
> 
> <n base="16">329F 2CA0</n>
> <n base="10" dec=".">12672611872.7889</n>
> 
> and from CSS:
> 
> number-format: base group-char decimal-char;
> 
> number-format: 32 " " ".";
> number-format: 2 none ",";
> 
> So, from HTML you define the format in which you provide the number. 
> Then from CSS you can change the base used for displaying, the chars to 
> be used for grouping digits and for separating the decimals.
> 
> Both attributes are optional. The dec attribute defines the char used 
> for separating the decimals (making it easier for the UA to convert the 
> number to the new number-format set by CSS).
> 
> This way we provide a fall back mecanism for browsers with no support 
> for <nr> and the CSS property. CSS 3 Math module would be appropriate 
> for adding such a property.
> 
> Also, this discussion would probably better fit into www-style mailing 
> list. Or ... maybe someone is interested in having this added to HTML 5.

On Thu, 8 Jun 2006, Andrew Fedoniouk wrote:
> 
> There are also other cases when we need special formatting... Thus I 
> think it is better to have something more generic in CSS:
> 
> text-format: number | currency | date | path-ellipsis | ellipsis
> 
> This will allow to render content in current format supported by 
> platform/locale.

On Wed, 7 Jun 2006, Anne van Kesteren wrote:
> 
> So the machine can just infer the format inside from the locale. The 
> only thing it needs to know is what the number is and perhaps what base 
> it is in. So you probably need <n base=""> or so and a thorough 
> definition. I'm just not sure if having a new element for each piece 
> that encloses something semantic is a solution that really scales. On 
> the other hand, it probably does for the top50 use cases or so.

On Thu, 8 Jun 2006, Lachlan Hunt wrote:
> 
> What about using it to mark up roman numerals as well?  Or, I guess, any 
> other number system in the world?
> 
>   <n>MMVI</n>
> 
> Of course, people could use the roman numerals in Unicode: U+2160 to 
> U+2183, but most people don't know they exist and it's much more 
> convenient to type regular letters.

On Fri, 23 Mar 2007, Christoph Päper wrote:
> > >
> > > The CSS community has requested a <date> or <time> element because 
> > > they want to restyle dates and times according to locale.
> 
> Then the recent request to www-style for styling numbers would be 
> justified as well. An element for times (or numbers) could have other 
> uses, though.

There has been more feedback on <time> than on <n>, which is the main 
reason we have <time> and not <n>.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list