#1752 closed defect (fixed)
duplicate registratio inside HtmlDragSource and HtmlDropTarget
Reported by: | Owned by: | alex | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | DnD | Version: | 0.4 |
Keywords: | dnd duplicate registration | Cc: | |
Blocked By: | Blocking: |
Description
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); // dojo.dnd.DropTarget.call(this); if(types && dojo.lang.isString(types)) { types = [types]; } this.acceptedTypes = types || []; }
Attachments (1)
Change History (8)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Milestone: | → 0.4.1 |
---|
comment:3 Changed 14 years ago by
Owner: | changed from psowden to alex |
---|---|
Status: | new → assigned |
Changed 14 years ago by
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
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
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.