Raise an error if color stops are specified in the wrong order.

Closes GH-118.
This commit is contained in:
Chris Eppstein 2010-05-02 14:55:07 -07:00
parent df447b5d6c
commit 910083b2f7

View File

@ -177,6 +177,14 @@ module Compass::SassExtensions::Functions::GradientSupport
end
end
end
# Make sure the color stops are specified in the right order.
positions.inject do |last_pos, pos|
puts pos.inspect
if last_pos.stop.value > pos.stop.value
raise Sass::SyntaxError.new("Color stops must be specified in increasing order")
end
pos
end
# normalize unitless numbers
positions.each do |pos|
if pos.stop.unitless? && pos.stop.value <= 1