Skip to content

Commit

Permalink
issue #90: @page inside @media
Browse files Browse the repository at this point in the history
  • Loading branch information
afelix committed Oct 11, 2012
1 parent 113499b commit 0b8de26
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 6 deletions.
10 changes: 8 additions & 2 deletions lib/gonzales.cssp.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ function getCSSPAST(_tokens, rule, _needInfo) {

if (l = checkSC(_i)) _i += l;

while (l = checkRuleset(_i)) {
while ((l = checkRuleset(_i)) || (l = checkAtrule(_i)) || (l = checkSC(_i))) {
_i += l;
}

Expand All @@ -693,7 +693,13 @@ function getCSSPAST(_tokens, rule, _needInfo) {
x;

while (!tokens[pos].atrulers_end) {
atrulers.push(getRuleset());
if (checkSC(pos)) {
atrulers = atrulers.concat(getSC());
} else if (checkRuleset(pos)) {
atrulers.push(getRuleset());
} else {
atrulers.push(getAtrule());
}
}

return atrulers.concat(getSC());
Expand Down
10 changes: 8 additions & 2 deletions src/gonzales.cssp.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ function getCSSPAST(_tokens, rule, _needInfo) {

if (l = checkSC(_i)) _i += l;

while (l = checkRuleset(_i)) {
while ((l = checkRuleset(_i)) || (l = checkAtrule(_i)) || (l = checkSC(_i))) {
_i += l;
}

Expand All @@ -693,7 +693,13 @@ function getCSSPAST(_tokens, rule, _needInfo) {
x;

while (!tokens[pos].atrulers_end) {
atrulers.push(getRuleset());
if (checkSC(pos)) {
atrulers = atrulers.concat(getSC());
} else if (checkRuleset(pos)) {
atrulers.push(getRuleset());
} else {
atrulers.push(getAtrule());
}
}

return atrulers.concat(getSC());
Expand Down
5 changes: 5 additions & 0 deletions test/data/test_stylesheet/issue90.test1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media test {
@page {
p: v;
}
}
5 changes: 5 additions & 0 deletions test/data/test_stylesheet/issue90.test1.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media test {
@page {
p: v;
}
}
29 changes: 29 additions & 0 deletions test/data/test_stylesheet/issue90.test1.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
['stylesheet',
['atruler',
['atkeyword',
['ident', 'media']],
['atrulerq',
['s', ' '],
['ident', 'test'],
['s', ' ']],
['atrulers',
['s', '
'],
['atruleb',
['atkeyword',
['ident', 'page']],
['s', ' '],
['block',
['s', '
'],
['declaration',
['property',
['ident', 'p']],
['value',
['s', ' '],
['ident', 'v']]],
['decldelim'],
['s', '
']]],
['s', '
']]]]
23 changes: 23 additions & 0 deletions test/data/test_stylesheet/issue90.test2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
x {
p:v;
}

@media test {
a {
p:v;
}

/* comment */

@page {
p: v;
}

b {
p:v;
}
}

y {
p:v;
}
23 changes: 23 additions & 0 deletions test/data/test_stylesheet/issue90.test2.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
x {
p:v;
}

@media test {
a {
p:v;
}

/* comment */

@page {
p: v;
}

b {
p:v;
}
}

y {
p:v;
}
109 changes: 109 additions & 0 deletions test/data/test_stylesheet/issue90.test2.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
['stylesheet',
['ruleset',
['selector',
['simpleselector',
['ident', 'x'],
['s', ' ']]],
['block',
['s', '
'],
['declaration',
['property',
['ident', 'p']],
['value',
['ident', 'v']]],
['decldelim'],
['s', '
']]],
['s', '
'],
['atruler',
['atkeyword',
['ident', 'media']],
['atrulerq',
['s', ' '],
['ident', 'test'],
['s', ' ']],
['atrulers',
['s', '
'],
['ruleset',
['selector',
['simpleselector',
['ident', 'a'],
['s', ' ']]],
['block',
['s', '
'],
['declaration',
['property',
['ident', 'p']],
['value',
['ident', 'v']]],
['decldelim'],
['s', '
']]],
['s', '
'],
['comment', ' comment '],
['s', '
'],
['atruleb',
['atkeyword',
['ident', 'page']],
['s', ' '],
['block',
['s', '
'],
['declaration',
['property',
['ident', 'p']],
['value',
['s', ' '],
['ident', 'v']]],
['decldelim'],
['s', '
']]],
['s', '
'],
['ruleset',
['selector',
['simpleselector',
['ident', 'b'],
['s', ' ']]],
['block',
['s', '
'],
['declaration',
['property',
['ident', 'p']],
['value',
['ident', 'v']]],
['decldelim'],
['s', '
']]],
['s', '
']]],
['s', '
'],
['ruleset',
['selector',
['simpleselector',
['ident', 'y'],
['s', ' ']]],
['block',
['s', '
'],
['declaration',
['property',
['ident', 'p']],
['value',
['ident', 'v']]],
['decldelim'],
['s', '
']]]]
10 changes: 8 additions & 2 deletions web/csso.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ function getCSSPAST(_tokens, rule, _needInfo) {

if (l = checkSC(_i)) _i += l;

while (l = checkRuleset(_i)) {
while ((l = checkRuleset(_i)) || (l = checkAtrule(_i)) || (l = checkSC(_i))) {
_i += l;
}

Expand All @@ -725,7 +725,13 @@ function getCSSPAST(_tokens, rule, _needInfo) {
x;

while (!tokens[pos].atrulers_end) {
atrulers.push(getRuleset());
if (checkSC(pos)) {
atrulers = atrulers.concat(getSC());
} else if (checkRuleset(pos)) {
atrulers.push(getRuleset());
} else {
atrulers.push(getAtrule());
}
}

return atrulers.concat(getSC());
Expand Down

0 comments on commit 0b8de26

Please sign in to comment.