Skip to content

Commit

Permalink
revise handling of @media in css parser
Browse files Browse the repository at this point in the history
my first take was completely wrong-headed
  • Loading branch information
marijnh committed Oct 8, 2010
1 parent 58441a0 commit 57cf34e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/parsecss.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,18 @@ var CSSParser = Editor.Parser = (function() {
if (content == "\n")
token.indentation = indentCSS(inBraces, inRule, basecolumn);

if (content == "{")
if (content == "{" && inDecl == "@media")
inDecl = false;
else if (content == "{")
inBraces = true;
else if (content == "}")
inBraces = inRule = inDecl = false;
else if (content == ";")
inRule = inDecl = false;
else if (inBraces && style != "css-comment" && style != "whitespace")
inRule = true;
else if (!inBraces && style == "css-at" && content != "@media")
inDecl = true;
else if (!inBraces && style == "css-at")
inDecl = content;

return token;
},
Expand Down

0 comments on commit 57cf34e

Please sign in to comment.