Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#1752 closed defect (fixed)

duplicate registratio inside HtmlDragSource and HtmlDropTarget

Reported by: [email protected] Owned by: alex
Priority: high Milestone:
Component: DnD Version: 0.4
Keywords: dnd duplicate registration Cc:
Blocked By: Blocking:


I found this problem both happend in HtmlDragSource? and HtmlDropTarget?. Here I just take dropTarget as an example,the dragSource is something similar.

Inside the dojo.dnd.DropTarget?'s init method, it make a call to dojo.dnd.dragManager's registerDropTarget() method to regist a dropTarget.And inside the dojo.dnd.HtmlDropTarget?'s init method it explicitly make a call to DropTarget?'s init() method.

But as HtmlDropTarget? is DropTarget?'s subclass,so when we create a HtmlDropTarget?'s instance,dojo will call DropTarget?'s init() method first,then it will call HtmlDropTarget?'s init() method which in turn call the DropTarget?'s init() method again. And this cause the registerDropTarget() method being called two times for the same dropTarget.

So maybe here, we should commemt out the explict call inside the HtmlDropTarget?'s init method like this.

function(node, types){
	if (arguments.length == 0) { return; }
	this.domNode = dojo.byId(node);
	if(types && dojo.lang.isString(types)) {
		types = [types];
	this.acceptedTypes = types || [];

Attachments (1)

dnd_init_and_wildcard.patch (5.3 KB) - added by [email protected] 14 years ago.
Patch for initialization woes (and a fix for broken wildcard support)

Download all attachments as: .zip

Change History (8)

comment:1 Changed 14 years ago by [email protected]

I am sorry,I have make a mistake.The HtmlDragSource? didn't has this problem.Because inside the HtmlDragManager?'s registerDragSource method it will reigst a dragSource only if the passed in dragSource object contain a domNode. So it doesn't matter we call the registerDragSource two times. But as the registerDropTarget didn't do this kind of comparation so we should comment the code like before.

comment:2 Changed 14 years ago by bill

Milestone: 0.4.1

comment:3 Changed 14 years ago by alex

Owner: changed from psowden to alex
Status: newassigned

Changed 14 years ago by [email protected]

Attachment: dnd_init_and_wildcard.patch added

Patch for initialization woes (and a fix for broken wildcard support)

comment:4 Changed 14 years ago by [email protected]

Here's a patch that fixes up the issue mentioned. I removed all registration work from the base class, instead delegating it to the derived classes that match up with the appropriate drag manager. Since we only really have a HtmlDragManager?, registration went to the first level Html(Drap|Drop) object.

The patch also fixes the busted * support for drop targets, and fixes the drag test that was requiring dojo.html.

comment:5 Changed 14 years ago by alex

(In [6549]) merging patch from Ben Lowery (CLA on file). refs #1752

comment:6 Changed 14 years ago by alex

Resolution: fixed
Status: assignedclosed

(In [6550]) merging patch from Ben Lowery (CLA on file). Fixes #1752

comment:7 Changed 13 years ago by (none)

Milestone: 0.4.1

Milestone 0.4.1 deleted

Note: See TracTickets for help on using tickets.