W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: [cssom-view] unrestricted double in ScrollToOptions

From: Simon Pieters <simonp@opera.com>
Date: Wed, 04 Mar 2015 10:40:11 +0100
To: "Ali Juma" <ajuma@chromium.org>
Cc: www-style <www-style@w3.org>, "Kip Gilbert" <kgilbert@mozilla.com>
Message-ID: <op.xuyvs9cjidj3kv@simons-mbp>
On Mon, 02 Mar 2015 16:39:33 +0100, Ali Juma <ajuma@chromium.org> wrote:

> On Mon, Mar 2, 2015 at 8:10 AM, Simon Pieters <simonp@opera.com> wrote:
>
>> On Fri, 27 Feb 2015 10:25:17 +0100, Simon Pieters <simonp@opera.com>
>> wrote:
>>
>>  The CSSOM View spec uses `double` in ScrollToOptions top/left  
>> dictionary
>>> members, which means that non-finite numbers throw TypeError per  
>>> WebIDL.
>>>
>>> http://dev.w3.org/csswg/cssom-view/#dictdef-scrolltooptions
>>>
>>> The spec uses `unrestricted double` (and converts non-finite numbers to
>>> zero) for the arguments that were traditionally `long`, since it  
>>> matches
>>> the traditional `long` behavior.
>>>
>>> Example: scrollTo(0, NaN); // same as x.scrollTo(0, 0);
>>>
>>> The ScrollToOptions dictionary is new so there is no Web compat to  
>>> worry
>>> about.
>>>
>>> Example: scrollTo({top: NaN}); // throws TypeError per spec
>>>
>>> However, in Gecko and Blink they are implemented as `unrestricted
>>> double`; non-finite numbers do not throw TypeError. (Blink doesn't  
>>> convert
>>> Infinity to zero, this is a known bug.) Should we change the spec to  
>>> make
>>> ScrollToOptions top/left `unrestricted double`, so that the dictionary
>>> behaves more like the old arguments? Or do people think it is more  
>>> useful
>>> to throw for non-finite numbers in the dictionary?
>>>
>>
>> kip, ajuma, any opinions?
>>
>
> Consistency with the existing scrolling methods seems like a good reason  
> to
> make ScrollToOptions top/left 'unrestricted double'. But I don't feel
> super-strongly about this, so if others feel that the value of throwing  
> on
> non-finite numbers here outweighs the value of consistency, I'd be fine
> with that too.

Thanks. It seems nobody feels strongly about it. I changed them to  
unrestricted double.

https://hg.csswg.org/drafts/rev/d8db5444d4d1

-- 
Simon Pieters
Opera Software
Received on Wednesday, 4 March 2015 09:40:09 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC