mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Sortable: Copy the src of the original item when creating a placeholder from an image. Fixes #5129 - Sortable: Unable to use an image as a placeholder in Firefox.
This commit is contained in:
parent
ca0b4b8a6c
commit
b9be6bb7ad
@ -84,6 +84,13 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div id="sortable-images">
|
||||||
|
<img src="../images/jqueryui_32x32.png">
|
||||||
|
<img src="../images/jqueryui_32x32.png">
|
||||||
|
<img src="../images/jqueryui_32x32.png">
|
||||||
|
<img src="../images/jqueryui_32x32.png">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
|
|
||||||
module("sortable: options");
|
module("sortable: options");
|
||||||
|
|
||||||
// this is here to make JSHint pass "unused", and we don't want to
|
|
||||||
// remove the parameter for when we finally implement
|
|
||||||
$.noop();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
test("{ appendTo: 'parent' }, default", function() {
|
test("{ appendTo: 'parent' }, default", function() {
|
||||||
ok(false, "missing test - untested code is broken code.");
|
ok(false, "missing test - untested code is broken code.");
|
||||||
@ -186,6 +182,23 @@ test("{ placeholder: false }, default", function() {
|
|||||||
ok(false, "missing test - untested code is broken code.");
|
ok(false, "missing test - untested code is broken code.");
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
test( "{ placeholder: false } img", function() {
|
||||||
|
expect( 3 );
|
||||||
|
|
||||||
|
var element = $( "#sortable-images" ).sortable({
|
||||||
|
start: function( event, ui ) {
|
||||||
|
equal( ui.placeholder.attr( "src" ), "../images/jqueryui_32x32.png", "placeholder img has correct src" );
|
||||||
|
equal( ui.placeholder.height(), 32, "placeholder has correct height" );
|
||||||
|
equal( ui.placeholder.width(), 32, "placeholder has correct width" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
element.find( "img" ).eq( 0 ).simulate( "drag", {
|
||||||
|
dy: 1
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test( "{ placeholder: String }", function() {
|
test( "{ placeholder: String }", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
|
2
ui/jquery.ui.sortable.js
vendored
2
ui/jquery.ui.sortable.js
vendored
@ -762,6 +762,8 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
// width of the table (browsers are smart enough to
|
// width of the table (browsers are smart enough to
|
||||||
// handle this properly)
|
// handle this properly)
|
||||||
element.append( "<td colspan='99'> </td>" );
|
element.append( "<td colspan='99'> </td>" );
|
||||||
|
} else if ( nodeName === "img" ) {
|
||||||
|
element.attr( "src", that.currentItem.attr( "src" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !className ) {
|
if ( !className ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user