Optimise chained return statements.

This commit is contained in:
Jürg Lehni 2011-03-14 22:13:01 +01:00
parent f02b7031a9
commit aae88d7568

View file

@ -66,15 +66,15 @@ var Color = this.Color = Base.extend(new function() {
if (!this._colorType) { if (!this._colorType) {
// Called on the abstract Color class. Guess color type // Called on the abstract Color class. Guess color type
// from arg // from arg
if (arg.red !== undefined) { return arg.red !== undefined
return new RGBColor(arg.red, arg.green, arg.blue, ? new RGBColor(arg.red, arg.green, arg.blue, arg.alpha)
arg.alpha); : arg.gray !== undefined
} else if (arg.gray !== undefined) { ? new GrayColor(arg.gray, arg.alpha)
return new GrayColor(arg.gray, arg.alpha); : arg.hue !== undefined
} else if (arg.hue !== undefined) { ? new HSBColor(arg.hue, arg.saturation, arg.brightness,
return new HSBColor(arg.hue, arg.saturation, arg.alpha)
arg.brightness, arg.alpha); : new RGBColor(); // Fallback
}
} else { } else {
// Called on a subclass instance. Return the converted // Called on a subclass instance. Return the converted
// color. // color.