Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit a8c84df

Browse files
committed
Stop the call structure for slider updates earlier on disabled inputs Fixes #4770
1 parent 7fc7407 commit a8c84df

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

js/jquery.mobile.forms.slider.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ $.widget( "mobile.slider", $.mobile.widget, {
150150

151151
// prevent screen drag when slider activated
152152
$( document ).bind( "vmousemove", function( event ) {
153-
if ( self.dragging ) {
153+
// NOTE: we don't do this in refresh because we still want to
154+
// support programmatic alteration of disabled inputs
155+
if ( self.dragging && !self.options.disabled ) {
154156
// self.mouseMoved must be updated before refresh() because it will be used in the control "change" event
155157
self.mouseMoved = true;
156158

@@ -168,6 +170,12 @@ $.widget( "mobile.slider", $.mobile.widget, {
168170
});
169171

170172
slider.bind( "vmousedown", function( event ) {
173+
// NOTE: we don't do this in refresh because we still want to
174+
// support programmatic alteration of disabled inputs
175+
if ( self.options.disabled ) {
176+
return false;
177+
}
178+
171179
self.dragging = true;
172180
self.userModified = false;
173181
self.mouseMoved = false;
@@ -299,6 +307,8 @@ $.widget( "mobile.slider", $.mobile.widget, {
299307

300308
refresh: function( val, isfromControl, preventInputUpdate ) {
301309

310+
// NOTE: we don't return here because we want to support programmatic
311+
// alteration of the input value, which should still update the slider
302312
if ( this.options.disabled || this.element.attr('disabled')) {
303313
this.disable();
304314
}

0 commit comments

Comments
 (0)