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

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