From 910083b2f736311cab22051736006c8bee81653c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 2 May 2010 14:55:07 -0700 Subject: [PATCH] Raise an error if color stops are specified in the wrong order. Closes GH-118. --- lib/compass/sass_extensions/functions/gradient_support.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/compass/sass_extensions/functions/gradient_support.rb b/lib/compass/sass_extensions/functions/gradient_support.rb index f4fa9d42..fbc9e048 100644 --- a/lib/compass/sass_extensions/functions/gradient_support.rb +++ b/lib/compass/sass_extensions/functions/gradient_support.rb @@ -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