/    Sign up×
Community /Pin to ProfileBookmark

Weird scriptaculous bug with droppables (IE Only)

I’m attempting to modify the scriptaculous drag/drop behavuior so that when I drag an icon into a droppable, it makes a copy (same ID, class, etc) in the droppable, and removes the original.

Here is the function I came up with to put in the onDrop parameter of my droppables:

[CODE]
function DropHandler(element,el){
var newnode = document.createElement(‘img’);
var classname = element.className;
newnode.src=”img/”+element.id+”.jpg”;
$(el).appendChild(newnode);
newnode.setAttribute(“class”, classname);
newnode.setAttribute(“className”, classname);
debugger;
element.parentNode.removeChild(element);
newnode.id = element.id;
new Draggable(newnode.id,{revert:true});
}
[/CODE]

This code works perfectly in firefox, but in IE, after you drop it will continuously place a copy of the draggable elements onmouseup to whatever droppable my mouse happens to be over at the time of my mouseup.

After a while it stops, but all my draggables are broken and do not work.

This especially puzzling because it works *perfectly* as planned in firefox.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@WiglyWormauthorAug 10.2009 — Updated info:

Using more primitive debugging techniques, the error seems to be in the line " element.parentNode.removeChild(element);" commenting this out allows the rest of the code to function, but leaving it in throws an error of "object expected", it's hard to tell more without a debugger.
×

Success!

Help @WiglyWorm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...