Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify exact length of array returned by Navigator.getGamepads() #13

Closed
luser opened this issue Apr 24, 2015 · 1 comment
Closed

Specify exact length of array returned by Navigator.getGamepads() #13

luser opened this issue Apr 24, 2015 · 1 comment

Comments

@luser
Copy link
Contributor

luser commented Apr 24, 2015

Originally filed as https://www.w3.org/Bugs/Public/show_bug.cgi?id=27986:

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.

[reply] [−] 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.

[reply] [−] Comment 2 Philip Jägenstedt 2015-02-10 08:52:23 UTC

Yes, Chrome does that, but it makes no sense to me :)

[reply] [−] 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.

@sgraham
Copy link
Contributor

sgraham commented Feb 14, 2018

Seems reasonable to me, updated in 83df143.

@sgraham sgraham closed this as completed Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants