lib/css_parser.rb in css_parser-1.2.1 vs lib/css_parser.rb in css_parser-1.2.2
- old
+ new
@@ -6,11 +6,11 @@
require 'zlib'
require 'stringio'
require 'iconv'
module CssParser
- VERSION = '1.2.0'
+ VERSION = '1.2.2'
# Merge multiple CSS RuleSets by cascading according to the CSS 2.1 cascading rules
# (http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order).
#
# Takes one or more RuleSet objects.
@@ -76,19 +76,17 @@
rule_set.each_declaration do |property, value, is_important|
# Add the property to the list to be folded per http://www.w3.org/TR/CSS21/cascade.html#cascading-order
if not properties.has_key?(property)
properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
+ elsif is_important and not properties[property][:is_important]
+ properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
elsif properties[property][:specificity] < specificity or properties[property][:specificity] == specificity
unless properties[property][:is_important]
properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
end
end
-
- if is_important
- properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
- end
- end
+ end
end
merged = RuleSet.new(nil, nil)
properties.each do |property, details|