Skip to content

Commit

Permalink
For consistency, always use our .mq rather than Modernizr.mq
Browse files Browse the repository at this point in the history
Someone usinge verge and Modernizr together could easily choose.
  • Loading branch information
ryanve committed Feb 2, 2014
1 parent c720edf commit c10da26
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/verge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
else root[name] = make();
}(this, 'verge', function() {

var xports = {}
var xports = {}
, win = typeof window != 'undefined' && window
, doc = typeof document != 'undefined' && document
, docElem = doc && doc.documentElement
, Modernizr = win['Modernizr']
, matchMedia = win['matchMedia'] || win['msMatchMedia']
, mq = matchMedia ? function(q) {
return !!matchMedia.call(win, q).matches;
Expand All @@ -28,21 +27,22 @@
};

/**
* Test if a media query is active. (Fallback uses Modernizr if avail.)
* Test if a media query is active. Like Modernizr.mq
* @since 1.6.0
* @return {boolean}
*/
xports['mq'] = !matchMedia && Modernizr && Modernizr['mq'] || mq;
xports['mq'] = mq;

/**
* Normalized, gracefully-degrading matchMedia.
* Normalized matchMedia
* @since 1.6.0
* @return {Object}
* @return {MediaQueryList|Object}
*/
xports['matchMedia'] = matchMedia ? function() {
// matchMedia must be binded to window
return matchMedia.apply(win, arguments);
} : function() {
// Gracefully degrade to plain object
return {};
};

Expand Down

0 comments on commit c10da26

Please sign in to comment.