From 09b3533910e887377fc87126608db1ded06f38f6 Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 2 Apr 2013 10:42:21 -0400 Subject: Sortable: Copy the cell structure when sorting a table row. Fixes #9185 - Sortable: Placeholder breaks table-layout: fixed. --- ui/jquery.ui.sortable.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index d16407216..7b145159e 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -752,15 +752,16 @@ $.widget("ui.sortable", $.ui.mouse, { element: function() { var nodeName = that.currentItem[0].nodeName.toLowerCase(), - element = $( that.document[0].createElement( nodeName ) ) + element = $( "<" + nodeName + ">", that.document[0] ) .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") .removeClass("ui-sortable-helper"); if ( nodeName === "tr" ) { - // Use a high colspan to force the td to expand the full - // width of the table (browsers are smart enough to - // handle this properly) - element.append( " " ); + that.currentItem.children().each(function() { + $( " ", that.document[0] ) + .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) + .appendTo( element ); + }); } else if ( nodeName === "img" ) { element.attr( "src", that.currentItem.attr( "src" ) ); } -- cgit v1.2.3