]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Add classes option
authorAlexander Schmitz <arschmitz@gmail.com>
Thu, 1 Jan 2015 17:10:26 +0000 (12:10 -0500)
committerAlexander Schmitz <arschmitz@gmail.com>
Wed, 11 Mar 2015 20:04:30 +0000 (16:04 -0400)
Ref #7053
Ref gh-1411

ui/draggable.js

index c57a3517c9831d123ddf2a7423fcfd6f1900a87a..83ad6487a552a5ef4824155553e29a26c3d583a7 100644 (file)
@@ -71,10 +71,10 @@ $.widget("ui.draggable", $.ui.mouse, {
                        this._setPositionRelative();
                }
                if (this.options.addClasses){
-                       this.element.addClass("ui-draggable");
+                       this._addClass( "ui-draggable" );
                }
                if (this.options.disabled){
-                       this.element.addClass("ui-draggable-disabled");
+                       this._addClass( "ui-draggable-disabled" );
                }
                this._setHandleClassName();
 
@@ -94,7 +94,6 @@ $.widget("ui.draggable", $.ui.mouse, {
                        this.destroyOnClear = true;
                        return;
                }
-               this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
                this._removeHandleClassName();
                this._mouseDestroy();
        },
@@ -170,7 +169,7 @@ $.widget("ui.draggable", $.ui.mouse, {
                //Create and append the visible helper
                this.helper = this._createHelper(event);
 
-               this.helper.addClass("ui-draggable-dragging");
+               this._addClass( this.helper, "ui-draggable-dragging" );
 
                //Cache the helper size
                this._cacheHelperProportions();
@@ -352,11 +351,11 @@ $.widget("ui.draggable", $.ui.mouse, {
        _setHandleClassName: function() {
                this.handleElement = this.options.handle ?
                        this.element.find( this.options.handle ) : this.element;
-               this.handleElement.addClass( "ui-draggable-handle" );
+               this._addClass( this.handleElement, "ui-draggable-handle" );
        },
 
        _removeHandleClassName: function() {
-               this.handleElement.removeClass( "ui-draggable-handle" );
+               this._removeClass( this.handleElement, "ui-draggable-handle" );
        },
 
        _createHelper: function(event) {
@@ -660,7 +659,7 @@ $.widget("ui.draggable", $.ui.mouse, {
        },
 
        _clear: function() {
-               this.helper.removeClass("ui-draggable-dragging");
+               this._removeClass( this.helper, "ui-draggable-dragging" );
                if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
                        this.helper.remove();
                }