[whatwg] number-related feedback

Ian Hickson ian at hixie.ch
Wed Jan 14 00:56:26 PST 2009


On Thu, 1 Jan 2009, Cameron McCormack wrote:
> 
> Ian Hickson:
> > The UA would set a limit on the value it accepts for maxlength="", and 
> > then cap the result at that, preventing someone from entering more than 
> > 4GB (or 2GB, or 4TB, or whatever limit the UA has). Does that answer your 
> > question? In practice I would expect other limitations to come into play 
> > long before a test for this limit could be triggered.
> 
> I don’t think it does answer the question, since you need to know what
> happens if you do:
> 
>   e.setAttribute('maxlength', '5000000000');
>   alert(e.maxlength)
> 
> The text currently in the spec isn’t clear:
> 
>   If a reflecting DOM attribute is an unsigned integer type (unsigned
>   long) then, on getting, the content attribute must be parsed according
>   to rules for parsing non-negative integers, and if that is successful,
>   the resulting value must be returned. If, on the other hand, it fails,
>   or if the attribute is absent, the default value must be returned
>   instead, or 0 if there is no default value.
> 
> The “rules for parsing non-negative integers” algorithm can return any
> non-negative integer.  Web IDL doesn’t define what to do if a spec
> defines an operation to return a value that is not a member of its
> return type.  I’d classify that as a bug in the description of
> reflecting DOM attributes.
> 
> I suggest to reword that paragraph to something like the following:
> 
>   If a reflecting DOM attribute is an unsigned integer type (unsigned
>   long) then, on getting, the content attribute must be parsed according
>   to rules for parsing non-negative integers, and if that successfully
>   returns a value in the range of an unsigned long, that resulting value
>   must be returned. If, on the other hand, it fails, returns an out of
>   range value, or if the attribute is absent, the default value must be
>   returned instead, or 0 if there is no default value.
> 
> Similar wording would be needed for other paragraphs in this section.

Done.

-- 
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