localstorage test failing in IE when it was disabled. thx kangax. fix… · Modernizr/Modernizr@d8947c9 · GitHub
Skip to content

Commit

Permalink
localstorage test failing in IE when it was disabled. thx kangax. fixes
Browse files Browse the repository at this point in the history
#40. other optimizations
  • Loading branch information
paulirish committed Jan 22, 2010
1 parent 4eef040 commit d8947c9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions modernizr.js
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
* @contributor Ben Alman
*/

window.Modernizr = (function(window,doc){
window.Modernizr = (function(window,doc,undefined){

var version = '1.2pre',

@@ -118,10 +118,10 @@ window.Modernizr = (function(window,doc){
background = 'background',
backgroundColor = background + 'Color',
canPlayType = 'canPlayType',
localStorage = 'localstorage',
sessionStorage = 'sessionstorage',
localStorage = 'localStorage',
sessionStorage = 'sessionStorage',
webWorkers = 'webworkers',
applicationCache = 'applicationcache',
applicationCache = 'applicationCache',
smil = 'smil',
hashchange = 'hashchange',
crosswindowmessaging = 'crosswindowmessaging',
@@ -274,7 +274,7 @@ window.Modernizr = (function(window,doc){
};

tests[hashchange] = function() {
return isEventSupported(hashchange, document.body);
return isEventSupported(hashchange, document.body || m);
};

tests[offlinedetection] = function() {
@@ -578,19 +578,19 @@ window.Modernizr = (function(window,doc){
// throw an error: https://bugzilla.mozilla.org/show_bug.cgi?id=365772
// if cookies are disabled
tests[localStorage] = function() {
return 'localStorage' in window;
return (localStorage in window) && window[localStorage] !== null;
};

tests[sessionStorage] = function() {
return 'sessionStorage' in window;
return sessionStorage in window;
};

tests[webWorkers] = function () {
return !!window.Worker;
};

tests[applicationCache] = function() {
var cache = window.applicationCache;
var cache = window[applicationCache];
return !!(cache && (typeof cache.status != 'undefined') && (typeof cache.update == 'function') && (typeof cache.swapCache == 'function'));
};

@@ -601,7 +601,6 @@ window.Modernizr = (function(window,doc){
};



// Run through all tests and detect their support in the current UA.
for ( feature in tests ) {
if ( tests.hasOwnProperty( feature ) ) {
@@ -621,6 +620,7 @@ window.Modernizr = (function(window,doc){
if (this.hasOwnProperty( feature )) {
// warn that feature test is already present
}
feature = feature.toLowerCase();
test = !!(test());
docElement.className += ' ' + (!test && enableNoClasses ? 'no-' : '') + feature;
ret[ feature ] = test;

0 comments on commit d8947c9

Please sign in to comment.