Skip to content

Commit

Permalink
toLowerCase normalization. web storage and appCache were going out as…
Browse files Browse the repository at this point in the history
… camelCase.
  • Loading branch information
paulirish committed May 16, 2010
1 parent 2d5e561 commit 4add4f5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,11 @@ window.Modernizr = (function(window,doc,undefined){
return !!test_props( props, callback );
}

// Tests

/**
* Canvas tests in Modernizr 1.x are still somewhat rudimentary. However,
* the added "canvastext" test allows for a slightly more reliable and
* usable setup.
* Tests
*/

tests[canvas] = function() {
return !!doc.createElement( canvas ).getContext;
};
Expand Down Expand Up @@ -699,16 +697,18 @@ window.Modernizr = (function(window,doc,undefined){



// end of tests.
// end of test definitions



// Run through all tests and detect their support in the current UA.
// todo: hypothetically we could be doing an array of tests and use a basic loop here.
for ( var feature in tests ) {
if ( tests.hasOwnProperty( feature ) ) {
// run the test, then based on the boolean, define an appropriate className
classes.push( ( ( ret[ feature ] = tests[ feature ]() ) ? '' : 'no-' ) + feature );
// run the test, throw the return value into the Modernizr,
// then based on that boolean, define an appropriate className
// and push it into an array of classes we'll join later.
classes.push( ( ( ret[ feature.toLowerCase() ] = tests[ feature ]() ) ? '' : 'no-' ) + feature.toLowerCase() );
}
}

Expand All @@ -729,10 +729,11 @@ window.Modernizr = (function(window,doc,undefined){
* @param test - Function returning true if feature is supported, false if not
*/
ret.addTest = function (feature, test) {
feature = feature.toLowerCase();

if (ret[ feature ]) {
return; // quit if you're trying to overwrite an existing test
}
feature = feature.toLowerCase();
test = !!(test());
docElement.className += ' ' + (test ? '' : 'no-') + feature;
ret[ feature ] = test;
Expand Down

0 comments on commit 4add4f5

Please sign in to comment.