Skip to content

Commit

Permalink
🐛 Add interpolation support to pseudo-classes for Sass
Browse files Browse the repository at this point in the history
  • Loading branch information
bgriffith authored and tonyganch committed Jun 21, 2016
1 parent 7d17c8e commit 6039575
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/sass/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -3467,6 +3467,9 @@ function checkPseudoClass3(i) {
if (l = checkSC(i)) i += l;

if (l = checkUnary(i)) i += l;

if (l = checkInterpolation(i)) i += l;

if (i >= tokensLength) return 0;
if (tokens[i].type === TokenType.DecimalNumber) i++;

Expand All @@ -3477,14 +3480,18 @@ function checkPseudoClass3(i) {
if (l = checkSC(i)) i += l;

if (i >= tokensLength) return 0;
if (tokens[i].value === '+' ||
tokens[i].value === '-') i++;

if (tokens[i].type === TokenType.PlusSign ||
tokens[i].type === TokenType.HyphenMinus) i++;
else return 0;

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

if (l = checkInterpolation(i)) i += l;

if (tokens[i].type === TokenType.DecimalNumber) i++;
else return 0;

if (l = checkInterpolation(i)) i += l;

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

Expand Down Expand Up @@ -3512,6 +3519,7 @@ function getPseudoClass3() {
pos++;

if (checkUnary(pos)) value.push(getUnary());
if (checkInterpolation(pos)) value.push(getInterpolation());
if (checkNumber(pos)) value.push(getNumber());

{
Expand All @@ -3525,8 +3533,10 @@ function getPseudoClass3() {

value = value.concat(getSC());
if (checkUnary(pos)) value.push(getUnary());
if (checkInterpolation(pos)) value.push(getInterpolation());
value = value.concat(getSC());
if (checkNumber(pos)) value.push(getNumber());
if (checkInterpolation(pos)) value.push(getInterpolation());
value = value.concat(getSC());

let end = getLastPosition(value, l, c, 1);
Expand Down Expand Up @@ -3565,6 +3575,9 @@ function checkPseudoClass4(i) {
if (l = checkSC(i)) i += l;

if (l = checkUnary(i)) i += l;

if (l = checkInterpolation(i)) i += l;

if (tokens[i].type === TokenType.DecimalNumber) i++;

if (tokens[i].value === 'n') i++;
Expand Down Expand Up @@ -3596,6 +3609,7 @@ function getPseudoClass4() {
pos++;

if (checkUnary(pos)) value.push(getUnary());
if (checkInterpolation(pos)) value.push(getInterpolation());
if (checkNumber(pos)) value.push(getNumber());
if (checkIdent(pos)) value.push(getIdent());
value = value.concat(getSC());
Expand Down

0 comments on commit 6039575

Please sign in to comment.