[csswg-drafts] [cssom-view] Clarify fallback for left and top options of scrollBy when absent

fred-wang has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Clarify fallback for left and top options of scrollBy when absent ==
For the one-parameter version of element.scrollBy and window.scrollBy, we have the following algorithms:  

>From https://drafts.csswg.org/cssom-view/#dom-element-scrollby:
>  Let options be the argument.
>  Normalize non-finite values for left and top dictionary members of options, if present.
> Add the value of scrollLeft to the left dictionary member.
> Add the value of scrollTop to the top dictionary member.
> Act as if the scroll() method was invoked with options as the only argument.

>From https://drafts.csswg.org/cssom-view/#dom-window-scrollby:
> Normalize non-finite values for the left and top dictionary members of options.
> Add the value of scrollX to the left dictionary member.
> Add the value of scrollY to the top dictionary member.
> Act as if the scroll() method was invoked with options as the only argument.

Adding scroll values when left or top are absent would lead to NaN and hence scroll() later would normalize the coordinates to 0. I think what we want instead is to fallback to 0 before adding the scroll values.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2978 using your GitHub account

Received on Wednesday, 1 August 2018 16:32:03 UTC