File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1798,8 +1798,10 @@ namespace Sass {
1798
1798
{
1799
1799
LOCAL_FLAG (is_in_selector_schema, true );
1800
1800
// the parser will look for a brace to end the selector
1801
+ ctx.c_options .in_selector = true ; // do not compress colors
1801
1802
Expression_Obj sel = s->contents ()->perform (this );
1802
1803
std::string result_str (sel->to_string (ctx.c_options ));
1804
+ ctx.c_options .in_selector = false ; // flag temporary only
1803
1805
result_str = unquote (Util::rtrim (result_str));
1804
1806
char * temp_cstr = sass_copy_c_string (result_str.c_str ());
1805
1807
ctx.strings .push_back (temp_cstr); // attach to context
Original file line number Diff line number Diff line change @@ -42,7 +42,9 @@ namespace Sass {
42
42
void Inspect::operator ()(Ruleset_Ptr ruleset)
43
43
{
44
44
if (ruleset->selector ()) {
45
+ opt.in_selector = true ;
45
46
ruleset->selector ()->perform (this );
47
+ opt.in_selector = false ;
46
48
}
47
49
if (ruleset->block ()) {
48
50
ruleset->block ()->perform (this );
@@ -600,6 +602,11 @@ namespace Sass {
600
602
// maybe an unknown token
601
603
std::string name = c->disp ();
602
604
605
+ if (opt.in_selector && name != " " ) {
606
+ append_token (name, c);
607
+ return ;
608
+ }
609
+
603
610
// resolved color
604
611
std::string res_name = name;
605
612
@@ -879,7 +886,9 @@ namespace Sass {
879
886
880
887
void Inspect::operator ()(Selector_Schema_Ptr s)
881
888
{
889
+ opt.in_selector = true ;
882
890
s->contents ()->perform (this );
891
+ opt.in_selector = false ;
883
892
}
884
893
885
894
void Inspect::operator ()(Parent_Selector_Ptr p)
Original file line number Diff line number Diff line change @@ -90,10 +90,13 @@ struct Sass_Inspect_Options {
90
90
// Precision for fractional numbers
91
91
int precision;
92
92
93
+ // Do not compress colors in selectors
94
+ bool in_selector;
95
+
93
96
// initialization list (constructor with defaults)
94
97
Sass_Inspect_Options (Sass_Output_Style style = Sass::NESTED,
95
- int precision = 5 )
96
- : output_style(style), precision(precision)
98
+ int precision = 5 , bool in_selector = false )
99
+ : output_style(style), precision(precision), in_selector(in_selector)
97
100
{ }
98
101
99
102
};
You can’t perform that action at this time.
0 commit comments