lib/beautiful-css/rule.rb in beautiful-css-0.1.01 vs lib/beautiful-css/rule.rb in beautiful-css-0.1.02
- old
+ new
@@ -7,14 +7,13 @@
@selector, @prop, @value = cleaner(selector), (prop || '').downcase, value
end
def cleaner sel
sel.to_s.split(' ').map do |part|
- if part =~ /^[^\.^#]/
- part.downcase
- else
- part
- end
+ #only tags are case insensitive
+ tag = part.split(/\.|#/)[0]
+ to_replace = Regexp.new("^"+ tag)
+ part.gsub to_replace, tag.downcase
end.join(' ')
end
def to_s
@selector + "\n" + "{ #{prop}:#{value} }"