W3C home > Mailing lists > Public > www-style@w3.org > July 2014

Re: [cssom-view] Specifying scroll options for scrollIntoView() without the "top" argument

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sun, 27 Jul 2014 08:58:56 -0400
Message-ID: <53D4F790.7020806@mit.edu>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Simon Pieters <simonp@opera.com>, www-style list <www-style@w3.org>, Cameron McCormack <cam@mcc.id.au>
On 7/27/14, 2:25 AM, Tab Atkins Jr. wrote:
> It's still possible to do, of course, if we're willing to abandon
> WebIDL handling and just use an "any" type that is introspected in
> prose.

You don't actually have to use "any".  It would be enough to do:

   void scrollIntoView();
   void scrollIntoView((boolean or object) arg);

and then manually convert the object to the ScrollOptions dictionary in 
prose.  That's one extra line of prose, basically.

In fact, if we didn't have this thing with dictionary types being 
required to be optional, we could write this as:

   void scrollIntoView();
   void scrollIntoView((boolean or ScrollOptions) arg);

I wonder whether it makes sense to change WebIDL to allow that somehow...

The main difference from the "object" case is that in this case you'd 
have to have the default value of "top" in the dictionary be false (so 
that explicitly passing null or undefined ends up picking up the "false" 
value) while if we did the "boolean or object" thing null/undefined 
would get converted to the boolean so you could default the dictionary 
member to whatever you want.

-Boris
Received on Sunday, 27 July 2014 12:59:29 UTC

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