Skip to content
This repository
Browse code

Stop the call structure for slider updates earlier on disabled inputs…

… Fixes #4770
  • Loading branch information...
commit e0a27f8c0de0792aad798f75209b1fba9f5ed19b 1 parent 4998f8c
John Bender authored July 30, 2012

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. 12  js/widgets/forms/slider.js
12  js/widgets/forms/slider.js
@@ -154,7 +154,9 @@ $.widget( "mobile.slider", $.mobile.widget, {
154 154
 
155 155
 		// prevent screen drag when slider activated
156 156
 		$( document ).bind( "vmousemove", function( event ) {
157  
-			if ( self.dragging ) {
  157
+			// NOTE: we don't do this in refresh because we still want to
  158
+			//       support programmatic alteration of disabled inputs
  159
+			if ( self.dragging && !self.options.disabled ) {
158 160
 				// self.mouseMoved must be updated before refresh() because it will be used in the control "change" event
159 161
 				self.mouseMoved = true;
160 162
 
@@ -177,6 +179,12 @@ $.widget( "mobile.slider", $.mobile.widget, {
177 179
 		control.bind( "vmouseup", $.proxy( self._checkedRefresh, self));
178 180
 
179 181
 		slider.bind( "vmousedown", function( event ) {
  182
+			// NOTE: we don't do this in refresh because we still want to
  183
+			//       support programmatic alteration of disabled inputs
  184
+			if ( self.options.disabled ) {
  185
+				return false;
  186
+			}
  187
+
180 188
 			self.dragging = true;
181 189
 			self.userModified = false;
182 190
 			self.mouseMoved = false;
@@ -321,6 +329,8 @@ $.widget( "mobile.slider", $.mobile.widget, {
321 329
 
322 330
 	refresh: function( val, isfromControl, preventInputUpdate ) {
323 331
 
  332
+		// NOTE: we don't return here because we want to support programmatic
  333
+		//       alteration of the input value, which should still update the slider
324 334
 		if ( this.options.disabled || this.element.attr('disabled')) {
325 335
 			this.disable();
326 336
 		}

0 notes on commit e0a27f8

Please sign in to comment.
Something went wrong with that request. Please try again.