From 5209cf70d7aca6388d5d0ba51c273b8ca023c285 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 30 Nov 2011 15:33:49 +0100 Subject: [PATCH] don't mutate values passed to Ox.rgb and Ox.hsl --- source/Ox/js/Color.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Ox/js/Color.js b/source/Ox/js/Color.js index 16588b50..2a2791b1 100644 --- a/source/Ox/js/Color.js +++ b/source/Ox/js/Color.js @@ -19,7 +19,7 @@ Ox.hsl = function(rgb) { if (arguments.length == 3) { rgb = Ox.makeArray(arguments); } - rgb = rgb.map(function(val) { + rgb = Ox.clone(rgb).map(function(val) { return val / 255; }); var max = Ox.max(rgb), @@ -66,6 +66,7 @@ Ox.rgb = function(hsl) { if (arguments.length == 3) { hsl = Ox.makeArray(arguments); } + hsl = Ox.clone(hsl); hsl[0] /= 360; var rgb = [0, 0, 0], v1, v2, v3;