File tree Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1298,6 +1298,14 @@ namespace Sass {
1298
1298
return false ;
1299
1299
}
1300
1300
1301
+ bool Selector_Schema::has_parent_ref ()
1302
+ {
1303
+ if (String_Schema* schema = dynamic_cast <String_Schema*>(contents ())) {
1304
+ return schema->length () > 0 && dynamic_cast <Parent_Selector*>(schema->at (0 )) != NULL ;
1305
+ }
1306
+ return false ;
1307
+ }
1308
+
1301
1309
void Selector_List::adjust_after_pushing (Complex_Selector* c)
1302
1310
{
1303
1311
// if (c->has_reference()) has_reference(true);
Original file line number Diff line number Diff line change @@ -1914,6 +1914,7 @@ namespace Sass {
1914
1914
Selector_Schema (ParserState pstate, String* c)
1915
1915
: Selector(pstate), contents_(c), at_root_(false )
1916
1916
{ }
1917
+ virtual bool has_parent_ref ();
1917
1918
virtual size_t hash () {
1918
1919
if (hash_ == 0 ) {
1919
1920
hash_combine (hash_, contents_->hash ());
Original file line number Diff line number Diff line change @@ -1732,7 +1732,9 @@ namespace Sass {
1732
1732
result_str = unquote (Util::rtrim (result_str)) + " \n {" ;
1733
1733
Parser p = Parser::from_c_str (result_str.c_str (), ctx, s->pstate ());
1734
1734
p.last_media_block = s->media_block ();
1735
- return operator ()(p.parse_selector_list (exp.block_stack .back ()->is_root ()));
1735
+ Selector_List* sl = p.parse_selector_list (exp.block_stack .back ()->is_root ());
1736
+ if (s->has_parent_ref ()) sl->remove_parent_selectors ();
1737
+ return operator ()(sl);
1736
1738
}
1737
1739
1738
1740
Expression* Eval::operator ()(Parent_Selector* p)
Original file line number Diff line number Diff line change @@ -621,8 +621,11 @@ namespace Sass {
621
621
Statement* Expand::operator ()(Extension* e)
622
622
{
623
623
if (Selector_List* extender = dynamic_cast <Selector_List*>(selector ())) {
624
- selector_stack.push_back (0 );
625
624
Selector* s = e->selector ();
625
+ if (Selector_Schema* schema = dynamic_cast <Selector_Schema*>(s)) {
626
+ if (schema->has_parent_ref ()) s = eval (schema);
627
+ }
628
+ selector_stack.push_back (0 );
626
629
expand_selector_list (s, extender);
627
630
selector_stack.pop_back ();
628
631
}
You can’t perform that action at this time.
0 commit comments