Intent to Implement and Ship: non-optional arguments to window.{move,resize}{To,By}

52 views
Skip to first unread message

Jens Widell

unread,
Jan 29, 2015, 9:34:02 AM1/29/15
to blin...@chromium.org

Contact emails

j...@opera.com


Spec

The functions are not part of any standard.


Summary

Currently, the arguments are optional, and each default to "current value"/"no-op". The proposal is to make them simply non-optional, aligning with Firefox's behavior. In IE the arguments are optional but default to zero, which leads to different behavior for moveTo()/resizeTo().


CL: https://codereview.chromium.org/886463010/


Motivation

Makes Blink's implementation slightly more straightforward, and reduces the number of different behaviors on the Web.


This change was suggested in https://codereview.chromium.org/879913003/, which among other things changed the argument types from float to long.


Compatibility Risk

Code that calls any of the functions with zero or one argument will start to throw TypeError exceptions. Such code would already be broken that way in Firefox, and would behave differently in IE if the called function is moveTo() or resizeTo().


OWP launch tracking bug?

None.


Link to entry on the feature dashboard

None.

Jens Widell

unread,
Jan 29, 2015, 9:44:02 AM1/29/15
to blin...@chromium.org
On Thu, Jan 29, 2015 at 3:33 PM, Jens Widell <j...@opera.com> wrote:

Contact emails

j...@opera.com


Spec

The functions are not part of any standard.


It was pointed out that these are in fact described here: http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface

The arguments are non-optional in the spec (and also unrestricted double instead of long).

Philip Jägenstedt

unread,
Jan 29, 2015, 9:52:35 AM1/29/15
to Jens Widell, blin...@chromium.org
LGTM, this seems low risk enough to try without use counters, but at
the first sign of trouble we should revert and add counters instead.
Just in case this turns into a long saga, can you create a tracking
bug to tie it all together?
> To unsubscribe from this group and stop receiving emails from it, send an
> email to blink-dev+...@chromium.org.

Jens Widell

unread,
Jan 29, 2015, 10:00:05 AM1/29/15
to Philip Jägenstedt, blin...@chromium.org

Jens Widell

unread,
Jan 29, 2015, 11:35:26 AM1/29/15
to blin...@chromium.org
On Thu, Jan 29, 2015 at 3:33 PM, Jens Widell <j...@opera.com> wrote:

Chris Harrelson

unread,
Jan 29, 2015, 2:15:08 PM1/29/15
to Jens Widell, blin...@chromium.org
I think we need some more data to make an informed decision about this proposal. Absent that, I would be supportive instead of a deprecate and use counter for cases when the arguments are omitted.

Chris

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Philip Rogers

unread,
Jan 29, 2015, 3:37:08 PM1/29/15
to Chris Harrelson, Jens Widell, blin...@chromium.org
I think this is a good change but I'm a little worried about breaking behavior between chrome and safari on mobile. I've kicked off a search for moveTo() without params to see if I can gauge how many sites would be affected.

Jens Widell

unread,
Feb 2, 2015, 7:45:09 AM2/2/15
to Philip Rogers, Chris Harrelson, blin...@chromium.org
Are these methods relevant on mobile you think? I would assume they're no-ops (regardless of arguments) on mobile platforms, and thus guess that they aren't typically used at all in content intended for mobile browsers.

Philip Jägenstedt

unread,
Feb 2, 2015, 10:47:34 AM2/2/15
to Philip Rogers, Chris Harrelson, Jens Widell, blin...@chromium.org
Hi Philip,

Did you get any results from that search that you can share with us?

Philip

John Mellor

unread,
Feb 2, 2015, 11:17:30 AM2/2/15
to Jens Widell, Philip Rogers, Chris Harrelson, blin...@chromium.org
Throwing a TypeError might cause more significant breakage than having the the methods be no-ops though, as not catching them might cause all subsequent JS to be skipped.

Philip Rogers

unread,
Feb 2, 2015, 2:18:45 PM2/2/15
to John Mellor, Jens Widell, Chris Harrelson, blin...@chromium.org
I searched the httparchive and found no real hits for moveTo(). My internal query is either failing or returning 0 results. I think we can actually go forward with removing this now without usecounters.

LGTM

Dimitri Glazkov

unread,
Feb 3, 2015, 12:27:39 PM2/3/15
to Philip Rogers, John Mellor, Jens Widell, Chris Harrelson, blin...@chromium.org
LGTM3.

Philip Jägenstedt

unread,
Feb 4, 2015, 4:37:43 AM2/4/15
to Philip Rogers, John Mellor, Jens Widell, Chris Harrelson, blin...@chromium.org
As requested off-list, I've searched the 20150101 httparchive data for
the regexp '(moveBy|moveTo|resizeBy|resizeTo)\([^,)]*\)' and got more
results than I hoped for. Because regular expressions can't arbitrary
depths of matching parenthesis there are lots of partial matches for
things like "moveTo((screen.width-375)/2,(screen.height-440)/2)".

However, there are also thousands of matches for things like
moveBy(c), moveBy(_), moveTo(a), etc. Looking for actual problems in
this data will be very tedious and I do not volunteer.

Because of this and that "In IE the arguments are optional but default
to zero" I now think we should first add use counters in the style of
AddEventListenerNoArguments and AddEventListenerOneArgument.

Jens, what do you think?

Philip

Jens Widell

unread,
Feb 4, 2015, 5:29:19 AM2/4/15
to Philip Jägenstedt, Philip Rogers, John Mellor, Chris Harrelson, blin...@chromium.org
On Wed, Feb 4, 2015 at 10:37 AM, Philip Jägenstedt <phi...@opera.com> wrote:
> As requested off-list, I've searched the 20150101 httparchive data for
> the regexp '(moveBy|moveTo|resizeBy|resizeTo)\([^,)]*\)' and got more
> results than I hoped for. Because regular expressions can't arbitrary
> depths of matching parenthesis there are lots of partial matches for
> things like "moveTo((screen.width-375)/2,(screen.height-440)/2)".
>
> However, there are also thousands of matches for things like
> moveBy(c), moveBy(_), moveTo(a), etc. Looking for actual problems in
> this data will be very tedious and I do not volunteer.

When searching GitHub for moveTo(), most matches are quite clearly not
calling window.moveTo() but rather other methods named moveTo(), that
often enough take one argument. So a simple text-based search will
require quite a bit of analysis to say much, I think.


> Because of this and that "In IE the arguments are optional but default
> to zero" I now think we should first add use counters in the style of
> AddEventListenerNoArguments and AddEventListenerOneArgument.
>
> Jens, what do you think?

This is a safer route for sure. I have no objections.

-- Jens

Philip Jägenstedt

unread,
Feb 4, 2015, 8:13:16 AM2/4/15
to Jens Widell, Philip Rogers, John Mellor, Chris Harrelson, blin...@chromium.org
On Wed, Feb 4, 2015 at 5:29 PM, Jens Widell <j...@opera.com> wrote:
> On Wed, Feb 4, 2015 at 10:37 AM, Philip Jägenstedt <phi...@opera.com> wrote:
>> As requested off-list, I've searched the 20150101 httparchive data for
>> the regexp '(moveBy|moveTo|resizeBy|resizeTo)\([^,)]*\)' and got more
>> results than I hoped for. Because regular expressions can't arbitrary
>> depths of matching parenthesis there are lots of partial matches for
>> things like "moveTo((screen.width-375)/2,(screen.height-440)/2)".
>>
>> However, there are also thousands of matches for things like
>> moveBy(c), moveBy(_), moveTo(a), etc. Looking for actual problems in
>> this data will be very tedious and I do not volunteer.
>
> When searching GitHub for moveTo(), most matches are quite clearly not
> calling window.moveTo() but rather other methods named moveTo(), that
> often enough take one argument. So a simple text-based search will
> require quite a bit of analysis to say much, I think.

Yeah, finding any actual problem among these is like finding a needle
in a haystack :/

>> Because of this and that "In IE the arguments are optional but default
>> to zero" I now think we should first add use counters in the style of
>> AddEventListenerNoArguments and AddEventListenerOneArgument.
>>
>> Jens, what do you think?
>
> This is a safer route for sure. I have no objections.

Great! Sorry for jumping the gun without checking the data first.

Philip
Reply all
Reply to author
Forward
0 new messages