Skip to content

Instantly share code, notes, and snippets.

@connrs
Created March 14, 2011 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save connrs/869039 to your computer and use it in GitHub Desktop.
Save connrs/869039 to your computer and use it in GitHub Desktop.
It's not the best test in the world but it suffices for me to yepnope load the CSS3 Media Queries lib from Google Code. Will eventually look at optimising it as it's 75% copy and paste from an unknown source
Modernizr.addTest('css3mediaquery',function(a,b){var a=document,b='screen and (min-width: 1px)',c={},d=a.documentElement,e=a.createElement("body"),f=a.createElement("div");f.setAttribute("id","ejs-qtest"),e.appendChild(f);return function(g){if(c[g]===b){var h=a.createElement("style");h.type="text/css";var i="@media "+g+" { #ejs-qtest { position: absolute; width: 10px; } }";h.styleSheet?h.styleSheet.cssText=i:h.appendChild(a.createTextNode(i)),d.insertBefore(e,d.firstChild),d.insertBefore(h,d.firstChild),c[g]=f.offsetWidth==10,d.removeChild(e),d.removeChild(h)}return c[g]}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment