From 1a28670720cbc815647d42a045a2fac44c0cd479 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 4 Aug 2009 23:35:08 +0000 Subject: [PATCH] Slider: Create a copy of the options.values array for the return value of _value(). Fixes #4751 - Dragging slider modifies values, even if callback returns false. Thanks bkrausz. --- ui/ui.slider.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/ui.slider.js b/ui/ui.slider.js index 1b5a9c5ac..7c603c624 100644 --- a/ui/ui.slider.js +++ b/ui/ui.slider.js @@ -482,7 +482,9 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { return val; } else { - return this.options.values; + // .slice() creates a copy of the array + // this prevents outside manipulation of the internal state + return this.options.values.slice(); } }, -- 2.39.5