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

input type="date" detection fails for Blackberry Torch (6800) #483

Closed
jabley opened this issue Feb 1, 2012 · 17 comments
Closed

input type="date" detection fails for Blackberry Torch (6800) #483

jabley opened this issue Feb 1, 2012 · 17 comments
Labels
change requested pr has open changerequests that need to be adressed

Comments

@jabley
Copy link

jabley commented Feb 1, 2012

Modernizr's detection is currently equivalent to this (as of 022e60f):

var input = document.createElement("input");
input.type = "date";
var bool = input.type !== "text";

/* 
  Certain browsers claim to support it, but actually don't 
  "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F192 Safari/6533.18.5"
  for instance. So we try setting an invalid value and see if it sticks.
 */
if (bool) {
  var smile = ";)";
  input.value = smile;
  bool = (input.value !== smile);
}

// Store the result of bool, set a cookie, etc.

The Blackberry 9800 capability does get correctly detected using version 1.0 of Modernizr, which http://www.miketaylr.com/code/input-type-attr.html currently uses. That is using the older version of the code without the enhancement added in #63.

Sorry, I've not managed to think of a good way of differentiating between the different cases, otherwise this would have been a pull request rather than just an issue raised.

@jabley
Copy link
Author

jabley commented Feb 1, 2012

Actually, don't investigate this just yet - I've just checked the web server logs and I don't think Javascript is enabled on the customer device. Doh!

@jabley
Copy link
Author

jabley commented Feb 1, 2012

Yep, the issue stands. It is a problem with Javascript detection on the Blackberry 9800 - confirmed using https://github.com/xdissent/ievms along with the relevant Blackberry simulator (Blackberry simulators being unfortunately Windows only).

@paulirish
Copy link
Member

Hmm this is a blackberry bug. :(

If they implement date inputs they need to implement date sanitization.

@paulirish
Copy link
Member

@jabley is there a place to report a bug to BB? can you?

@staabm
Copy link

staabm commented May 11, 2012

@jasondscott

@jabley
Copy link
Author

jabley commented May 11, 2012

@staabm, thanks! I'll see if he picks up on this thread.

@jasondscott
Copy link

Use This

if (bool) {
  input.value = "2012-05-01";
  bool = (input.valueAsDate instanceof Date);
}

Instead of

if (bool) {
  var smile = ";)";
  input.value = smile;
  bool = (input.value !== smile);
}

Tested on BB 7.1, Firefox, Chrome, Opera

I hope that helps.

@paulirish
Copy link
Member

That's pretty leet. Okay cool. We can augment for this extra check.

Thank you very much @jasondscott

@paulirish
Copy link
Member

There are a few "date" inputs...

datetime date month week time datetime-local

Does Torch support all of those?

@jasondscott
Copy link

By quick test all of those except week
I will confirm that though.

@jasondscott
Copy link

It looks like we do support week
Here is the full list of supported input types for BB7 http://docs.blackberry.com/en/developers/deliverables/26991/HTML_input_types_1247751_11.jsp

jabley added a commit to jabley/Modernizr that referenced this issue May 14, 2012
@jabley
Copy link
Author

jabley commented May 14, 2012

I've added some code (cee3a70) to try to include these more specific date time input tests, but I'm seeing a couple of failures locally.

no global variables should leak (other than Modernizr and iepp)
Expected: ""
Result:     "toString,constructor"
Diff: "" "toString,constructor" 
Source: ()@file:///Users/jabley/work/github/Modernizr/test/qunit/qunit.js:102

And

firefox12: Caniuse result for touch matches Modernizr's result for touch
Expected: true
Result: false
Diff: true false 
Source: ()@file:///Users/jabley/work/github/Modernizr/test/js/unit-caniuse.js:176

Can someone help me understand what I've broken?

patrickkettner added a commit to patrickkettner/Modernizr that referenced this issue Jun 1, 2013
@patrickkettner
Copy link
Member

@jabley I pulled down your old repo and the only issue is here that you are looking for

  input.value = dateDetection[inputElemType];

rather than

  inputElem.value = dateDetection[inputElemType];

Since this is very outdated, I updated the test to use the new AMD format, and did a pull in #960

@patrickkettner
Copy link
Member

ping @stucox
is the marketshare on bb os 6 too low to warrant the updated test?

@patrickkettner
Copy link
Member

Closing this, due to the age and only-old-blackberry-ness of it. Feel free to yell at me, though =D

@goldins
Copy link

goldins commented Aug 18, 2014

I am getting a similar issue now with the latest version of Google Chrome Canary (Version 39.0.2127.0 canary (64-bit)). This was not an issue with older versions.

The specified value ':)' does not conform to the required format, 'yyyy-MM-dd'.

@patrickkettner
Copy link
Member

Hey @goldins - super sorry about that. That particular issue is actually being tracked in #1412 - basically its something we consider a bug in chrome, and google will (hopefully) be removing that new, er, "feature" shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change requested pr has open changerequests that need to be adressed
Projects
None yet
Development

No branches or pull requests

6 participants