Skip to content

Commit 5a089a0

Browse files
committed
Merge pull request #1183 from mgreter/bugfix/issue_1016
Fix parent selector interpolation in attribute selector
2 parents a87ad20 + 3f536a9 commit 5a089a0

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

contextualize.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ namespace Sass {
3232
Selector_List* ss = 0;
3333
if (p) {
3434
ss = new (ctx.mem) Selector_List(s->pstate(), p->length() * s->length());
35+
if (s->length() == 0) {
36+
Complex_Selector* comb = static_cast<Complex_Selector*>(parent->perform(this));
37+
if (parent->has_line_feed()) comb->has_line_feed(true);
38+
if (comb) *ss << comb;
39+
else cerr << "Warning: contextualize returned null" << endl;
40+
}
3541
for (size_t i = 0, L = p->length(); i < L; ++i) {
3642
for (size_t j = 0, L = s->length(); j < L; ++j) {
3743
parent = (*p)[i];
3844
Complex_Selector* comb = static_cast<Complex_Selector*>((*s)[j]->perform(this));
3945
if (parent->has_line_feed()) comb->has_line_feed(true);
4046
if (comb) *ss << comb;
47+
else cerr << "Warning: contextualize returned null" << endl;
4148
}
4249
}
4350
}

contextualize_eval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace Sass {
6464
// the value might be interpolated; evaluate it
6565
String* v = s->value();
6666
if (v && eval) {
67-
Eval* eval_with = eval->with(env, backtrace);
67+
Eval* eval_with = eval->with(parent, env, backtrace);
6868
v = static_cast<String*>(v->perform(eval_with));
6969
}
7070
To_String toString;

expand.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ namespace Sass {
5454
}
5555

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

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

0 commit comments

Comments
 (0)