diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-04-02 10:42:21 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-04-02 10:42:21 -0400 |
commit | 09b3533910e887377fc87126608db1ded06f38f6 (patch) | |
tree | f20c5bf4ae3ac44a1b228e282e6229dba0fcd119 /ui/jquery.ui.sortable.js | |
parent | 5217b975f32aeca0bf12ca76f24084f319b46ebe (diff) | |
download | jquery-ui-09b3533910e887377fc87126608db1ded06f38f6.tar.gz jquery-ui-09b3533910e887377fc87126608db1ded06f38f6.zip |
Sortable: Copy the cell structure when sorting a table row. Fixes #9185 - Sortable: Placeholder breaks table-layout: fixed.
Diffstat (limited to 'ui/jquery.ui.sortable.js')
-rw-r--r-- | ui/jquery.ui.sortable.js | 11 |
1 files changed, 6 insertions, 5 deletions
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( "<td colspan='99'> </td>" ); + that.currentItem.children().each(function() { + $( "<td> </td>", that.document[0] ) + .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) + .appendTo( element ); + }); } else if ( nodeName === "img" ) { element.attr( "src", that.currentItem.attr( "src" ) ); } |