Browse files

Respond now supports media-type-less queries, so there's no longer a …

…need to write @media screen and (..) { or even @media all and (..) { when @media  (..) { will do just fine. Fixes #53, which is long overdue.
  • Loading branch information...
1 parent 67f8cc3 commit a7ef2b1c449aed8ff5fa82b270184f9acf73ec44 scottjehl committed Jan 27, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 respond.src.js
  2. +2 −2 test/unit/test.css
View
2 respond.src.js
@@ -148,7 +148,7 @@ window.matchMedia = window.matchMedia || (function(doc, undefined){
for( ; j < eql; j++ ){
thisq = eachq[ j ];
mediastyles.push( {
- media : thisq.match( /(only\s+)?([a-zA-Z]+)(\sand)?/ ) && RegExp.$2,
+ media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
rules : rules.length - 1,
minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
View
4 test/unit/test.css
@@ -16,8 +16,8 @@
display: block;
}
-/*styles for 480px and up */
-@media screen and (min-width: 480px) {
+/*styles for 480px and up - media type purposely left out here to test that in the process */
+@media (min-width: 480px) {
#testelem {
width: 150px;
}

0 comments on commit a7ef2b1

Please sign in to comment.