This repository was archived by the owner on Oct 24, 2025. It is now read-only.
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 {
12981298 return false ;
12991299 }
13001300
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+
13011309 void Selector_List::adjust_after_pushing (Complex_Selector* c)
13021310 {
13031311 // if (c->has_reference()) has_reference(true);
Original file line number Diff line number Diff line change @@ -1914,6 +1914,7 @@ namespace Sass {
19141914 Selector_Schema (ParserState pstate, String* c)
19151915 : Selector(pstate), contents_(c), at_root_(false )
19161916 { }
1917+ virtual bool has_parent_ref ();
19171918 virtual size_t hash () {
19181919 if (hash_ == 0 ) {
19191920 hash_combine (hash_, contents_->hash ());
Original file line number Diff line number Diff line change @@ -1732,7 +1732,9 @@ namespace Sass {
17321732 result_str = unquote (Util::rtrim (result_str)) + " \n {" ;
17331733 Parser p = Parser::from_c_str (result_str.c_str (), ctx, s->pstate ());
17341734 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);
17361738 }
17371739
17381740 Expression* Eval::operator ()(Parent_Selector* p)
Original file line number Diff line number Diff line change @@ -621,8 +621,11 @@ namespace Sass {
621621 Statement* Expand::operator ()(Extension* e)
622622 {
623623 if (Selector_List* extender = dynamic_cast <Selector_List*>(selector ())) {
624- selector_stack.push_back (0 );
625624 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 );
626629 expand_selector_list (s, extender);
627630 selector_stack.pop_back ();
628631 }
You can’t perform that action at this time.
0 commit comments