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 @@ -1804,8 +1804,10 @@ namespace Sass {
1804
1804
{
1805
1805
LOCAL_FLAG (is_in_selector_schema, true );
1806
1806
// the parser will look for a brace to end the selector
1807
+ ctx.c_options .in_selector = true ; // do not compress colors
1807
1808
Expression_Obj sel = s->contents ()->perform (this );
1808
1809
std::string result_str (sel->to_string (ctx.c_options ));
1810
+ ctx.c_options .in_selector = false ; // flag temporary only
1809
1811
result_str = unquote (Util::rtrim (result_str));
1810
1812
char * temp_cstr = sass_copy_c_string (result_str.c_str ());
1811
1813
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 );
@@ -622,6 +624,11 @@ namespace Sass {
622
624
// maybe an unknown token
623
625
std::string name = c->disp ();
624
626
627
+ if (opt.in_selector && name != " " ) {
628
+ append_token (name, c);
629
+ return ;
630
+ }
631
+
625
632
// resolved color
626
633
std::string res_name = name;
627
634
@@ -909,7 +916,9 @@ namespace Sass {
909
916
910
917
void Inspect::operator ()(Selector_Schema_Ptr s)
911
918
{
919
+ opt.in_selector = true ;
912
920
s->contents ()->perform (this );
921
+ opt.in_selector = false ;
913
922
}
914
923
915
924
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