Optimise GradientStop constructor for better minification.

This commit is contained in:
Jürg Lehni 2012-12-18 13:49:29 +01:00
parent 15824e7aaf
commit 05ab8910ea

View file

@ -30,19 +30,22 @@ var GradientStop = this.GradientStop = Base.extend(/** @lends GradientStop# */{
*/
initialize: function(arg0, arg1) {
if (arg0) {
var color, rampPoint;
if (arg1 === undefined && Array.isArray(arg0)) {
// [color, rampPoint]
this.setColor(arg0[0]);
this.setRampPoint(arg0[1]);
} else if (arg0 && arg0.color) {
color = arg0[0];
rampPoint = arg0[1];
} else if (arg0.color) {
// stop
this.setColor(arg0.color);
this.setRampPoint(arg0.rampPoint);
color = arg0.color;
rampPoint = arg0.rampPoint;
} else {
// color [, rampPoint]
this.setColor(arg0);
this.setRampPoint(arg1);
// color, rampPoint
color = arg0;
rampPoint = arg1;
}
this.setColor(color);
this.setRampPoint(rampPoint);
}
},