diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index cd2fa873c..0ae48a381 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -31,9 +31,9 @@ $.widget( "ui.draggable", $.ui.interaction, { options: { appendTo: null, + exclude: "input,textarea,button,select,option", handle: null, - helper: false, - exclude: "input,textarea,button,select,option" + helper: false }, // dragEl: element being dragged (original or helper) @@ -136,7 +136,7 @@ $.widget( "ui.draggable", $.ui.interaction, { this._blockFrames(); }, - _resetDomPosition : function() { + _resetDomPosition: function() { // Nothing to do in this case if ( !this.domPosition ) { @@ -494,12 +494,12 @@ if ( $.uiBackCompat !== false ) { if ( this.options.axis === "x" ) { // Cache starting top position to keep it from moving - this.element.on( "dragbeforestart", function( e, ui ) { + this.element.on( "dragbeforestart", function( event, ui ) { startTop = ui.position.top; }); // On drag, make sure top does not change so axis is locked - this.element.on( "drag", function( e, ui ) { + this.element.on( "drag", function( event, ui ) { ui.position.top = startTop; }); @@ -508,12 +508,12 @@ if ( $.uiBackCompat !== false ) { else if ( this.options.axis === "y" ) { // Cache starting left position to keep it from moving - this.element.on( "dragbeforestart", function( e, ui ) { + this.element.on( "dragbeforestart", function( event, ui ) { startLeft = ui.position.left; }); // On drag, make sure top does not change so axis is locked - this.element.on( "drag", function( e, ui ) { + this.element.on( "drag", function( event, ui ) { ui.position.left = startLeft; }); @@ -537,25 +537,22 @@ if ( $.uiBackCompat !== false ) { if ( this.options.cursor ) { self = this; - body = $( document.body ); + body = $( this.document[0].body ); // Cache original cursor to set back - this.element.on( "dragstart", function( e, ui ) { - startCursor = body.css( "cursor" ); + this.element.on( "dragstart", function( event, ui ) { + startCursor = body.style.cursor; }); // Set cursor to what user wants during drag - this.element.on( "drag", function( e, ui ) { + this.element.on( "drag", function( event, ui ) { body.css( "cursor", self.options.cursor ); }); // Set back cursor to whatever default was - this.element.on( "dragstop", function( e, ui ) { + this.element.on( "dragstop", function( event, ui ) { - // Make sure something was actually reported back before setting body - if ( startCursor ) { - body.css( "cursor", startCursor ); - } + body.css( "cursor", startCursor ); }); @@ -585,7 +582,7 @@ if ( $.uiBackCompat !== false ) { cursorAt = this.options.cursorAt; - this.element.on( "dragbeforestart", function( e, ui ) { + this.element.on( "dragbeforestart", function( event, ui ) { var elem = self.dragEl; @@ -628,7 +625,7 @@ if ( $.uiBackCompat !== false ) { x = this.options.grid[0]; y = this.options.grid[1]; - this.element.on( "dragbeforestart", function( e, ui ) { + this.element.on( "dragbeforestart", function( event, ui ) { // Save off the start position currentX = ui.position.left; @@ -636,14 +633,13 @@ if ( $.uiBackCompat !== false ) { }); - this.element.on( "drag", function( e, ui ) { + this.element.on( "drag", function( event, ui ) { // If x is actually something, check that user is at least half way to next point if ( x ) { if ( ui.position.left - currentX > x/2 ) { currentX = currentX + x; - } - else if ( currentX - ui.position.left > x/2 ) { + } else if ( currentX - ui.position.left > x/2 ) { currentX = currentX - x; } } @@ -652,8 +648,7 @@ if ( $.uiBackCompat !== false ) { if ( y ) { if ( ui.position.top - currentY > y/2 ) { currentY = currentY + y; - } - else if ( currentY - ui.position.top > y/2 ) { + } else if ( currentY - ui.position.top > y/2 ) { currentY = currentY - y; } } @@ -687,7 +682,7 @@ if ( $.uiBackCompat !== false ) { return; } - this.element.on( "dragstart", function( e, ui ) { + this.element.on( "dragstart", function( event, ui ) { // Cache the original opacity of draggable element to reset later originalOpacity = self.dragEl.css( 'opacity' ); @@ -697,7 +692,7 @@ if ( $.uiBackCompat !== false ) { }); - this.element.on( "dragstop", function( e, ui ) { + this.element.on( "dragstop", function( event, ui ) { // Reset opacity self.dragEl.css( 'opacity', originalOpacity ); @@ -728,7 +723,7 @@ if ( $.uiBackCompat !== false ) { return; } - this.element.on( "dragbeforestart", function( e, ui ) { + this.element.on( "dragbeforestart", function( event, ui ) { // Cache the original css of draggable element to reset later originalLeft = self.dragEl.css( 'left' ); @@ -737,7 +732,7 @@ if ( $.uiBackCompat !== false ) { }); - this.element.on( "dragstop", function( e, ui ) { + this.element.on( "dragstop", function( event, ui ) { // Reset to before drag self.dragEl.animate({ @@ -770,7 +765,7 @@ if ( $.uiBackCompat !== false ) { return; } - this.element.on( "dragstart", function( e, ui ) { + this.element.on( "dragstart", function( event, ui ) { // Cache the original zIndex of draggable element to reset later originalZIndex = self.dragEl.css( 'z-index' ); @@ -780,7 +775,7 @@ if ( $.uiBackCompat !== false ) { }); - this.element.on( "dragstop", function( e, ui ) { + this.element.on( "dragstop", function( event, ui ) { // Reset zIndex self.dragEl.css( 'z-index', originalZIndex ); diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index e7785205f..b3888b7ef 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -449,7 +449,6 @@ $.widget( "ui.sortable", $.ui.interaction, { }, _blockFrames: function() { - var body = this.document[0].body; this.iframeBlocks = this.document.find( "iframe" ).map(function() { var iframe = $( this ), @@ -463,7 +462,7 @@ $.widget( "ui.sortable", $.ui.interaction, { top: iframeOffset.top, left: iframeOffset.left }) - .appendTo( body )[0]; + .appendTo( iframe.parent() )[0]; }); },