Skip to content

Commit

Permalink
Fixed: @media only works when it's the first character of the input s…
Browse files Browse the repository at this point in the history
…tring
  • Loading branch information
NV committed Nov 19, 2010
1 parent 103d297 commit e7ede8f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CSSOM.parse = function parse(token, options) {

// At-rule
case "@":
if (token.indexOf("@media", i) == 0) {
if (token.indexOf("@media", i) == i) {
state = "atBlock";
i += "media".length;
break;
Expand Down
27 changes: 27 additions & 0 deletions test/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,33 @@ var TESTS = [
]
}
},
{
input: "a{}@media all{b{color:#000}}",
result: {
cssRules: [
{
selectorText: "a",
style: {}
},
{
media: {
0: "all",
length: 1
},
cssRules: [
{
selectorText: "b",
style: {
0: "color",
color: "#000",
length: 1
}
}
]
}
]
}
},
{
input: "@mediaall {}",
result: {
Expand Down

0 comments on commit e7ede8f

Please sign in to comment.