Skip to content

Loading…

Updating gamepads test to match new spec #646

Merged
merged 2 commits into from

3 participants

@ebidel

No description provided.

@ebidel

Fix for #645

@paulirish paulirish commented on an outdated diff
feature-detects/gamepad.js
@@ -2,4 +2,5 @@
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
// By Eric Bidelman
-Modernizr.addTest('gamepads', !!Modernizr.prefixed('gamepads', navigator));
+Modernizr.addTest('gamepads', !!Modernizr.prefixed('Gamepads', navigator) ||
+ !!Modernizr.prefixed('GetGamepads', navigator));
@paulirish Modernizr member

lowercase for both, actually. getGamepads. prefixed() will uppercase both while it checks for prefixes versions. but the standard unprefixed is targetting lower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@paulirish paulirish merged commit eb5ed64 into Modernizr:master
@paulirish
Modernizr member

pulled. thx. i'm gonna make a note about FF's inability to feature detect.

@Ms2ger

Hey Paul, what do you mean by "FF's inability to feature detect"?

@paulirish
Modernizr member

@Ms2ger I mean there is no way to feature detect support for the gamepad API in Firefox.

You can only see that gamepad events are firing, but cannot see that the API is available

A day after posting the above, I realized that gamepad support is only available in special builds and not even behind a flag in nightly firefox. So it's not a huge deal. Sounds like updating the impl to the newest spec rev will happen soon.

@Ms2ger

Oh, because we don't support the navigator property in the initial patch, right. |"GamePad" in window| should work, though.

@ebidel

IMO we should probably stay way from returning a false positive for FF's implementation.
It's not up to date with the current spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 2, 2012
  1. @ebidel

    New spec is getGamePads

    ebidel committed
  2. @ebidel

    lowercasing checks

    ebidel committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 feature-detects/gamepad.js
View
3 feature-detects/gamepad.js
@@ -2,4 +2,5 @@
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
// By Eric Bidelman
-Modernizr.addTest('gamepads', !!Modernizr.prefixed('gamepads', navigator));
+Modernizr.addTest('gamepads', !!Modernizr.prefixed('gamepads', navigator) ||
+ !!Modernizr.prefixed('getGamepads', navigator));
Something went wrong with that request. Please try again.