diff --git a/src/sortable.js b/src/sortable.js index a18f046..065179c 100644 --- a/src/sortable.js +++ b/src/sortable.js @@ -133,7 +133,8 @@ angular.module('ui.sortable', []) // the start and stop of repeat sections and sortable doesn't // respect their order (even if we cancel, the order of the // comments are still messed up). - if (hasSortingHelper(element, ui) && !ui.item.sortable.received) { + if (hasSortingHelper(element, ui) && !ui.item.sortable.received && + element.sortable( 'option', 'appendTo' ) === 'parent') { // restore all the savedNodes except .ui-sortable-helper element // (which is placed last). That way it will be garbage collected. savedNodes = savedNodes.not(savedNodes.last()); diff --git a/test/sortable.e2e.spec.js b/test/sortable.e2e.spec.js index dc2cdaf..21923d2 100644 --- a/test/sortable.e2e.spec.js +++ b/test/sortable.e2e.spec.js @@ -381,6 +381,30 @@ describe('uiSortable', function() { }); }); + it('should work when "helper: clone" and "appendTo" options are used together', function() { + inject(function($compile, $rootScope) { + var element; + element = $compile('