vendor/assets/javascripts/jquery.ui.draggable.js in jquery-ui-rails-0.3.0 vs vendor/assets/javascripts/jquery.ui.draggable.js in jquery-ui-rails-0.4.0

- old
+ new

@@ -1,11 +1,11 @@ //= require jquery.ui.core //= require jquery.ui.widget //= require jquery.ui.mouse /*! - * jQuery UI Draggable 1.8.19pre + * jQuery UI Draggable 1.8.20 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * @@ -210,12 +210,18 @@ if(this.dropped) { dropped = this.dropped; this.dropped = false; } - //if the original element is removed, don't bother to continue if helper is set to "original" - if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") + //if the original element is no longer in the DOM don't bother to continue (see #8269) + var element = this.element[0], elementInDom = false; + while ( element && (element = element.parentNode) ) { + if (element == document ) { + elementInDom = true; + } + } + if ( !elementInDom && this.options.helper === "original" ) return false; if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { var self = this; $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { @@ -507,10 +513,10 @@ } }); $.extend($.ui.draggable, { - version: "1.8.19pre" + version: "1.8.20" }); $.ui.plugin.add("draggable", "connectToSortable", { start: function(event, ui) {