This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27986 - Specify exact length of array returned by Navigator.getGamepads()
Summary: Specify exact length of array returned by Navigator.getGamepads()
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Gamepad (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ted Mielczarek [:ted]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-09 11:13 UTC by Philip Jägenstedt
Modified: 2015-04-24 11:03 UTC (History)
3 users (show)

See Also:


Attachments

Description Philip Jägenstedt 2015-02-09 11:13:40 UTC
https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#widl-Navigator-getGamepads-sequence-Gamepad

"The length of the array returned must be at least one more than the maximum index value of the Gamepad objects returned in the array."

This offers more flexibility than seems useful, allowing e.g. an array of length 100 to always be returned. Always returning an array of the minimum length possible seems better.
Comment 1 Ted Mielczarek [:ted] 2015-02-09 12:03:42 UTC
I'm not really sure why this is spec'ed this way, I think Scott wrote that text. I know Chrome (and possibly IE) always return an Array of length 4 even when no gamepads are connected.

Firefox always returns an array of the minimum possible length.
Comment 2 Philip Jägenstedt 2015-02-10 08:52:23 UTC
Yes, Chrome does that, but it makes no sense to me :)
Comment 3 Philip Jägenstedt 2015-02-10 08:53:31 UTC
I guess it made more sense when the object returned (GamepadList) is the same every time, less so when you return a new array every time.
Comment 4 Ted Mielczarek [:ted] 2015-04-24 11:03:25 UTC
Moved to https://github.com/w3c/gamepad/issues/13