Skip to content

Commit

Permalink
Respond now supports media-type-less queries, so there's no longer a …
Browse files Browse the repository at this point in the history
…need to write @media screen and (..) { or even @media all and (..) { when @media  (..) { will do just fine. Fixes scottjehl#53, which is long overdue.
  • Loading branch information
scottjehl committed Jan 27, 2012
1 parent 67f8cc3 commit a7ef2b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion respond.src.js
Expand Up @@ -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 || "" )
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test.css
Expand Up @@ -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;
}
Expand Down

0 comments on commit a7ef2b1

Please sign in to comment.