Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "[slider] Move _preventDocumentDrag function into the widget p…

…rototype and attach it with ._on() to ensure removal upon destroy()"

This reverts commit e9b1f56.
  • Loading branch information...
commit 4a57ddcab425b4f629bbd1ae5d699d97a49522cc 1 parent eace2d9
@gabrielschulhof gabrielschulhof authored
Showing with 23 additions and 22 deletions.
  1. +23 −22 js/widgets/forms/slider.js
View
45 js/widgets/forms/slider.js
@@ -152,7 +152,28 @@ $.widget( "mobile.slider", $.mobile.widget, {
self.refresh( val(), true );
});
- this._on( document, { "vmousemove": "_preventDocumentDrag" } );
+ this._preventDocumentDrag = function( event ) {
+ // NOTE: we don't do this in refresh because we still want to
+ // support programmatic alteration of disabled inputs
+ if ( self.dragging && !self.options.disabled ) {
+
+ // self.mouseMoved must be updated before refresh() because it will be used in the control "change" event
+ self.mouseMoved = true;
+
+ if ( cType === "select" ) {
+ // make the handle move in sync with the mouse
+ handle.removeClass( "ui-slider-handle-snapping" );
+ }
+
+ self.refresh( event );
+
+ // only after refresh() you can calculate self.userModified
+ self.userModified = self.beforeStart !== control[0].selectedIndex;
+ return false;
+ }
+ }
+
+ $( document ).bind( "vmousemove", this._preventDocumentDrag );
// it appears the clicking the up and down buttons in chrome on
// range/number inputs doesn't trigger a change until the field is
@@ -291,27 +312,6 @@ $.widget( "mobile.slider", $.mobile.widget, {
this.refresh( undefined, undefined, true );
},
- _preventDocumentDrag: function( event ) {
- // NOTE: we don't do this in refresh because we still want to
- // support programmatic alteration of disabled inputs
- if ( this.dragging && !this.options.disabled ) {
-
- // self.mouseMoved must be updated before refresh() because it will be used in the control "change" event
- this.mouseMoved = true;
-
- if ( this._type === "select" ) {
- // make the handle move in sync with the mouse
- this.handle.removeClass( "ui-slider-handle-snapping" );
- }
-
- this.refresh( event );
-
- // only after refresh() you can calculate self.userModified
- this.userModified = this.beforeStart !== this.element[0].selectedIndex;
- return false;
- }
- },
-
_checkedRefresh: function() {
if( this.value != this._value() ){
this.refresh( this._value() );
@@ -324,6 +324,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
},
_destroy: function() {
+ $( document ).unbind( "vmousemove", this._preventDocumentDrag );
$( document ).unbind( "vmouseup", this._sliderMouseUp );
},
Please sign in to comment.
Something went wrong with that request. Please try again.