class Sanitize::CSS
def property!(prop)
Sanitizes a CSS property node. Returns the sanitized node, or `nil` if the
def property!(prop) name = prop[:name].downcase # Preserve IE * and _ hacks if desired. if @config[:allow_hacks] name.slice!(0) if /\A[*_]/.match?(name) end return nil unless @config[:properties].include?(name) nodes = prop[:children].dup combined_value = +"" nodes.each do |child| value = child[:value] case child[:node] when :ident combined_value << value.downcase if String === value when :function if child.key?(:name) name = child[:name].downcase if name == "url" return nil unless valid_url?(child) end if image_function?(name) return nil unless valid_image?(child) end combined_value << name return nil if name == "expression" || combined_value == "expression" end if Array === value nodes.concat(value) elsif String === value lowercase_value = value.downcase combined_value << lowercase_value return nil if lowercase_value == "expression" || combined_value == "expression" end when :url return nil unless valid_url?(child) when :bad_url return nil end end prop end