Skip to content

Commit

Permalink
Merge pull request sass#1183 from mgreter/bugfix/issue_1016
Browse files Browse the repository at this point in the history
Fix parent selector interpolation in attribute selector
  • Loading branch information
mgreter committed May 9, 2015
2 parents a87ad20 + 3f536a9 commit 5a089a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions contextualize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ namespace Sass {
Selector_List* ss = 0;
if (p) {
ss = new (ctx.mem) Selector_List(s->pstate(), p->length() * s->length());
if (s->length() == 0) {
Complex_Selector* comb = static_cast<Complex_Selector*>(parent->perform(this));
if (parent->has_line_feed()) comb->has_line_feed(true);
if (comb) *ss << comb;
else cerr << "Warning: contextualize returned null" << endl;
}
for (size_t i = 0, L = p->length(); i < L; ++i) {
for (size_t j = 0, L = s->length(); j < L; ++j) {
parent = (*p)[i];
Complex_Selector* comb = static_cast<Complex_Selector*>((*s)[j]->perform(this));
if (parent->has_line_feed()) comb->has_line_feed(true);
if (comb) *ss << comb;
else cerr << "Warning: contextualize returned null" << endl;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion contextualize_eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace Sass {
// the value might be interpolated; evaluate it
String* v = s->value();
if (v && eval) {
Eval* eval_with = eval->with(env, backtrace);
Eval* eval_with = eval->with(parent, env, backtrace);
v = static_cast<String*>(v->perform(eval_with));
}
To_String toString;
Expand Down
4 changes: 2 additions & 2 deletions expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ namespace Sass {
}

Contextualize_Eval* contextual = contextualize_eval->with(selector_stack.back(), env, backtrace);
if (old_in_at_root && !r->selector()->has_reference())
contextual = contextualize_eval->with(at_root_selector_stack.back(), env, backtrace);
// if (old_in_at_root && !r->selector()->has_reference())
// contextual = contextualize_eval->with(selector_stack.back(), env, backtrace);

Selector* sel_ctx = r->selector()->perform(contextual);
if (sel_ctx == 0) throw "Cannot expand null selector";
Expand Down

0 comments on commit 5a089a0

Please sign in to comment.