Skip to content

Commit 081dddb

Browse files
committed
Update src/css/MediaQuery.js
MediaQuery mediaType and features needs to be joined trough "and". For example parsing "only screen and (min-width:450px) and (max-width:1950px)", the text output will be "only screen (min-width:450px) and (max-width:1950px)". It is parsed right but the new text string will be invalid if matched with window.matchMedia.
1 parent 74592d6 commit 081dddb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/css/MediaQuery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
function MediaQuery(modifier, mediaType, features, line, col){
1515

16-
SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType + " " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
16+
SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
1717

1818
/**
1919
* The media modifier ("not" or "only")

0 commit comments

Comments
 (0)