W3C home > Mailing lists > Public > www-style@w3.org > October 2013

[cssom-view] behavior of document.body.scrollTop

From: Mike Sherov <mike.sherov@gmail.com>
Date: Tue, 8 Oct 2013 22:55:14 -0400
Message-ID: <-6319842957783041634@unknownmsgid>
To: www-style@w3.org
A recent change in Blink attempted to correct the behavior of
document.documentElement.scrollTop and document.body.scrollTop to match the
spec and the other browsers:

http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop

However, it seems that the spec may inadvertently underdefine setter
behavior on document.body.scrollTop when NOT in quirks mode. This has
caused Blink to maintain the old, possibly incorrect behavior:
https://codereview.chromium.org/26489005/

The spec *seems* to indicate that document.body.scrollTop SHOULD NOT be a
no-op in standards mode. If this is the intention, thank Blink is correct
in reverting and the other browsers are wrong.

However, I believe the intent is that document.body.scrollTop SHOULD be a
no-op in standards mode (which matches other browsers. Read these steps
carefully... nothing prevents document.body.scrollTop from getting to step
6 in standards mode, and I believe it a spec bug, not the intention:

When setting the
scrollTop<http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop>
attribute
these steps must be run:

   1.

   If the given value is a
ScrollOptionsVertical<http://dev.w3.org/csswg/cssom-view/#scrolloptionsvertical>
object,
   and the ydictionary member is not present, abort these steps.
   2.

   If the given value is a
ScrollOptionsVertical<http://dev.w3.org/csswg/cssom-view/#scrolloptionsvertical>
object,
   let y be the value of the y dictionary member. Otherwise, let y be the
   given value.
   3.

   If the element does not have any associated CSS layout
box<http://dev.w3.org/csswg/cssom-view/#css-layout-box>,
   the element is the root element and the
Document<http://dom.spec.whatwg.org/#document> is
   in quirks mode <http://dom.spec.whatwg.org/#concept-document-quirks>, or
   the element has no associated scrolling
box<http://dev.w3.org/csswg/cssom-view/#scrolling-box>,
   or the element has no overflow, terminate these steps.
   4.

   If the element is the root element invoke
scroll()<http://dev.w3.org/csswg/cssom-view/#dom-window-scroll>
    with scrollX <http://dev.w3.org/csswg/cssom-view/#dom-window-scrollx>as
   first argument and y as second, and, if the given value is a
   ScrollOptionsVertical<http://dev.w3.org/csswg/cssom-view/#scrolloptionsvertical>
object,
   the given value as the third argument.
   5.

   If the element is the HTML body
element<http://dev.w3.org/csswg/cssom-view/#the-html-body-element>,
   the Document <http://dom.spec.whatwg.org/#document> is inquirks
mode<http://dom.spec.whatwg.org/#concept-document-quirks>,
   and the element does not have any vertical overflow, invoke
scroll()<http://dev.w3.org/csswg/cssom-view/#dom-window-scroll>
    with scrollX <http://dev.w3.org/csswg/cssom-view/#dom-window-scrollx> as
   first argument and y as second, and, if the given value is a
   ScrollOptionsVertical<http://dev.w3.org/csswg/cssom-view/#scrolloptionsvertical>
object,
   the given value as the third argument.
   6.

   Scroll the element<http://dev.w3.org/csswg/cssom-view/#scroll-an-element>
    to scrollLeft<http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft>
   ,y, with the scroll behavior being the value of the behavior dictionary
   member if the given value is a
ScrollOptionsVertical<http://dev.w3.org/csswg/cssom-view/#scrolloptionsvertical>
object,
   or auto otherwise.

Some clarification would be greatly appreciated!

Mike Sherov
Chief Technologist
SNAP Interactive, Inc. | Ticker: STVI
http://snap-interactive.com | http://ayi.com
Received on Wednesday, 9 October 2013 02:55:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:51:02 UTC