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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 22 Jul 2014 18:05:55 -0700
Message-ID: <CAAWBYDBs9EZ4mf=-uLQT550evHQ=uswP6y5Ni8377tEP0kKq4g@mail.gmail.com>
To: www-style list <www-style@w3.org>
Right now, the spec defines two overloads for scrollIntoView(): one
with no arguments, and one with a boolean arg and a ScrollOptions arg.
This means that if you want to specify any scroll options, you must
provide an opaque boolean value.

Boolean args are an anti-pattern that we don't do today, but of course
this is a legacy part of the API.  If we were designing this from
scratch, this would just be part of the ScrollOptions dict.

I propose we add a third overload that takes just a ScrollOptions
dict, for when you don't want to control the top/bottom behavior and
don't want to supply an opaque dummy bool.

If no one's implemented the current ScrollOptions overload yet, then I
also propose we drop that overload entirely, and add an "align"
attribute to ScrollOptions that takes "top" or "bottom" (or maybe a
"top" attribute that takes a bool, whatever).  That way you either
call the function with the legacy boolean arg, or with the modern dict
arg, not both.

~TJ
Received on Wednesday, 23 July 2014 01:06:41 UTC

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