Opened 13 years ago

Closed 12 years ago

#2621 closed defect (fixed)

DnD operation causes an exception in IE when a DropTarget has been removed

Reported by: tw@… Owned by: psowden
Priority: high Milestone:
Component: DnD Version: 0.4.2rc1
Keywords: Cc:
Blocked By: Blocking:

Description

Whenever a DropTarget? disappears from a page (for example after a .setContent("") call on a ContentPane? that previousley had DropTargets? defined), subsequent DnD operations cause IE to raise an execption in dojo.dnd.dragManager.cacheTargetLocations().

proposed fix:

--- ./src/dnd/HtmlDragManager.js.old    Tue Mar 20 14:51:47 2007
+++ ./src/dnd/HtmlDragManager.js        Tue Mar 20 14:54:26 2007
@@ -178,6 +178,7 @@
        this.dropTargetDimensions = [];
        dojo.lang.forEach(this.dropTargets, function (tempTarget) {
                var tn = tempTarget.domNode;
+               if ( tn.parentNode == null ) { return; }
                if (!tn || !tempTarget.accepts([this.dragSource])) {
                        return;
                }

maybe add

                if ( tn.offsetWidth == 0 ) { return; }

at the same place? This should prevent 'invisible' targets to be added to the array (tested in FF and IE6).

BTW, maybe ContentPane?.setContent() should cleanup DragSources/DropTargets? from the 'old' content - as it does for widgets now.

Attachments (1)

droptargets.html (2.4 KB) - added by tw@… 13 years ago.
Testcase added…

Download all attachments as: .zip

Change History (2)

Changed 13 years ago by tw@…

Attachment: droptargets.html added

Testcase added...

comment:1 Changed 12 years ago by Eugene Lazutkin

Resolution: fixed
Status: newclosed

Fixed in 0.9.

Note: See TracTickets for help on using tickets.