premailer/css_parser

`expand_shorthand!` overrides subsequent styles

ojab opened this issue · 0 comments

ojab commented

If line-height, for example, is set after font — it gets overridden:

> rule_set = CssParser::RuleSet.new(nil, 'font:15px; line-height:0')
=> #<CssParser::RuleSet:0x00000000040a11e0 @declarations={"font"=>{:value=>"15px", :is_important=>false, :order=>1}, "line-height"=>{:value=>"0", :is_important=>false, :order=>2}}, @order=2, @selectors=[], @specificity=nil>
> rule_set.expand_shorthand!
=> nil
> rule_set
=> #<CssParser::RuleSet:0x00000000040a11e0
 @declarations=
  {"line-height"=>{:value=>"normal", :is_important=>false, :order=>1},
   "font-style"=>{:value=>"normal", :is_important=>false, :order=>1},
   "font-variant"=>{:value=>"normal", :is_important=>false, :order=>1},
   "font-weight"=>{:value=>"normal", :is_important=>false, :order=>1},
   "font-size"=>{:value=>"15px", :is_important=>false, :order=>1}},
 @order=2,
 @selectors=[],
 @specificity=nil>