Skip to content

Commit

Permalink
Fix a false-negative for number fields in Safari 5.0.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Dec 21, 2010
1 parent 6968d6e commit f84b3d9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,9 @@ window.Modernizr = (function(window,document,undefined){
inputElem.setAttribute('type', props[i]);
bool = inputElem.type !== 'text';

// Chrome likes to falsely purport support, so we feed it a textual value;
// Webkit likes to falsely purport support, so we feed it a textual value;
// if that doesnt succeed then we know there's a custom UI
if (bool){

inputElem.value = smile;

if (/^range$/.test(inputElem.type) && inputElem.style.WebkitAppearance !== undefined){
Expand All @@ -781,10 +780,13 @@ window.Modernizr = (function(window,document,undefined){
// even make it here.

} else if (/^(url|email)$/.test(inputElem.type)) {

// Real url and email support comes with prebaked validation.
bool = inputElem.checkValidity && inputElem.checkValidity() === false;


} else if (inputElem.type === "number"){
// Safari 5.0.3 accepts the smile for number fields, which it actually does support...
bool = inputElem.value != smile || inputElem.checkValidity && inputElem.checkValidity() === false

} else {
// If the upgraded input compontent rejects the :) text, we got a winner
bool = inputElem.value != smile;
Expand Down

0 comments on commit f84b3d9

Please sign in to comment.