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

On Sun, 27 Jul 2014 14:58:56 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:

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

OK, done.

https://dvcs.w3.org/hg/csswg/diff/c678078eb0a9/cssom-view/Overview.src.html

So now you can do

scrollIntoView()                 // top=true
scrollIntoView(true)             // top=true
scrollIntoView(false)            // top=false
scrollIntoView(undefined)        // top=false
scrollIntoView({})               // top=true
scrollIntoView({block: "start"}) // top=true
scrollIntoView({block: "end"})   // top=false

I intend to add {block: "center"} to address  
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17152

I called it "block" so that we can add "inline" for the other direction  
and "vertical"/"horizontal" for physical alignment, but I'm not married to  
the names. Certainly {block: "start"} on its own looks a bit weird.  
Suggestions welcome.

-- 
Simon Pieters
Opera Software

Received on Thursday, 18 September 2014 11:16:30 UTC