#4772 closed bug (duplicate)
"Prevented" Slides Still Change Values
Reported by: | machineghost | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | ui.slider | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In theory returning false from a "slide" event handler (in the Slider component) should prevent any values from being changed. However, this is not the case ;-(
Note: See
TracTickets for help on using
tickets.
The reason this isn't the case is because of the following lines (in "_slide"; don't have exact line numbers because my copy has local changes):
The problem is that this.values() returns a live reference to the values array (this.options.values), and thus newValues is basically just an alias; if you change it, you change the slider's values ... even if 'this._trigger("slide", event, ...' returns false.
Luckily, this is super simple to fix; just replace the first line with:
so that it gets a clone of the values rather than a pointer.