Skip to content

Commit

Permalink
On Firefox, with hidden iframes, matchMedia returns null, thus trying to
Browse files Browse the repository at this point in the history
access .matches crashes things. Added extra check to make sure we stay
up and running.
Also, added .project to gitignore
  • Loading branch information
mikkotikkanen committed Mar 28, 2013
1 parent af5f597 commit 3a4f0a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ build
dist
tmp
.DS_Store
.project
2 changes: 1 addition & 1 deletion src/testMediaQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define(['injectElementWithStyles'], function( injectElementWithStyles ) {
var matchMedia = window.matchMedia || window.msMatchMedia;
var bool;
if ( matchMedia ) {
return matchMedia(mq).matches;
return matchMedia(mq) && matchMedia(mq).matches || false;
}

injectElementWithStyles('@media ' + mq + ' { #modernizr { position: absolute; } }', function( node ) {
Expand Down

0 comments on commit 3a4f0a3

Please sign in to comment.