Skip to content

Commit

Permalink
If the test added via addTest is NOT a function or Boolean Modernizr …
Browse files Browse the repository at this point in the history
…dies.

Prevent cases such as `Modernizr.addTest("breakeverything", undefined);` from annihilating the internet.
  • Loading branch information
David Murdoch committed Nov 30, 2011
1 parent 1991630 commit 1c2feb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -899,10 +899,10 @@ window.Modernizr = (function( window, document, undefined ) {
return;
}

test = typeof test == "boolean" ? test : !!test();
test = typeof test == 'function' ? test() : test;

docElement.className += ' ' + (test ? '' : 'no-') + feature;
Modernizr[feature] = test;
Modernizr[feature] = !!test;

}

Expand Down

0 comments on commit 1c2feb5

Please sign in to comment.