Skip to content

Commit

Permalink
🐛 Add interpolation support for all pseudo-class combos
Browse files Browse the repository at this point in the history
  • Loading branch information
bgriffith authored and tonyganch committed Jun 21, 2016
1 parent 9e9b89f commit be05fba
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/scss/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -3092,6 +3092,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 @@ -3102,14 +3105,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 @@ -3137,6 +3144,7 @@ function getPseudoClass3() {
pos++;

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

{
Expand All @@ -3150,8 +3158,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 @@ -3189,7 +3199,12 @@ function checkPseudoClass4(i) {

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

// Check for leading unary `-`
if (l = checkUnary(i)) i += l;

// Check for interpolation `#{i}`
if (l = checkInterpolation(i)) i += l;

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

if (tokens[i].value === 'n') i++;
Expand Down Expand Up @@ -3223,6 +3238,7 @@ function getPseudoClass4() {
value = value.concat(getSC());

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 be05fba

Please sign in to comment.