File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ <h2 id="qunit-userAgent"></h2>
42
42
43
43
< div id ="draggable1 " style ="width: 25px; height: 25px; "> Draggable</ div >
44
44
< div id ="droppable1 " style ="width: 100px; height: 100px; "> Droppable</ div >
45
+ < div id ="droppable2 " style ="width: 100px; height: 100px; "> Droppable</ div >
45
46
< div style ='width:1000px;height:1000px; '> </ div >
46
47
47
48
</ div >
Original file line number Diff line number Diff line change 5
5
6
6
module ( "droppable: events" ) ;
7
7
8
+ test ( "droppable destruction/recreation on drop event" , function ( ) {
9
+ expect ( 1 ) ;
10
+
11
+ var config = {
12
+ activeClass : "active" ,
13
+ drop : function ( ) {
14
+ var element = $ ( this ) ,
15
+ newDroppable = $ ( "<div>" )
16
+ . css ( { width : 100 , height : 100 } )
17
+ . text ( "Droppable" ) ;
18
+ element . after ( newDroppable ) ;
19
+ element . remove ( ) ;
20
+ newDroppable . droppable ( config ) ;
21
+ }
22
+ } ,
23
+
24
+ draggable = $ ( "#draggable1" ) . draggable ( ) ,
25
+ droppable1 = $ ( "#droppable1" ) . droppable ( config ) ,
26
+ droppable2 = $ ( "#droppable2" ) . droppable ( config ) ,
27
+
28
+ droppableOffset = droppable1 . offset ( ) ,
29
+ draggableOffset = draggable . offset ( ) ,
30
+ dx = droppableOffset . left - draggableOffset . left ,
31
+ dy = droppableOffset . top - draggableOffset . top ;
32
+
33
+ draggable . simulate ( "drag" , {
34
+ dx : dx ,
35
+ dy : dy
36
+ } ) ;
37
+
38
+ ok ( ! droppable2 . hasClass ( "active" ) , "subsequent droppable no longer active" ) ;
39
+ } ) ;
40
+
8
41
// this is here to make JSHint pass "unused", and we don't want to
9
42
// remove the parameter for when we finally implement
10
43
$ . noop ( ) ;
Original file line number Diff line number Diff line change @@ -278,7 +278,8 @@ $.ui.ddmanager = {
278
278
drop : function ( draggable , event ) {
279
279
280
280
var dropped = false ;
281
- $ . each ( $ . ui . ddmanager . droppables [ draggable . options . scope ] || [ ] , function ( ) {
281
+ // Create a copy of the droppables in case the list changes during the drop (#9116)
282
+ $ . each ( ( $ . ui . ddmanager . droppables [ draggable . options . scope ] || [ ] ) . slice ( ) , function ( ) {
282
283
283
284
if ( ! this . options ) {
284
285
return ;
You can’t perform that action at this time.
0 commit comments