File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ <h2 id="qunit-userAgent"></h2>
4242
4343< div id ="draggable1 " style ="width: 25px; height: 25px; "> Draggable</ div >
4444< div id ="droppable1 " style ="width: 100px; height: 100px; "> Droppable</ div >
45+ < div id ="droppable2 " style ="width: 100px; height: 100px; "> Droppable</ div >
4546< div style ='width:1000px;height:1000px; '> </ div >
4647
4748</ div >
Original file line number Diff line number Diff line change 55
66module ( "droppable: events" ) ;
77
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+
841// this is here to make JSHint pass "unused", and we don't want to
942// remove the parameter for when we finally implement
1043$ . noop ( ) ;
Original file line number Diff line number Diff line change @@ -278,7 +278,8 @@ $.ui.ddmanager = {
278278 drop : function ( draggable , event ) {
279279
280280 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 ( ) {
282283
283284 if ( ! this . options ) {
284285 return ;
You can’t perform that action at this time.
0 commit comments