This project is read-only.

Probably broken: "Items added to list after dragsort code called will now be able to be dragged"

Dec 15, 2009 at 9:52 AM


Release notes to v.3.8 claim that now it is possible to drag newly added items after dragsort code was already launched

"Items added to list after dragsort code called will now be able to be dragged."

But either it is seems that this functionality is broken or I'm doing something wrong.

To reproduce the problem we need to open dragsort-0.3.8/example.html in FireFox and execute in console (maybe it's easier to do in FireFox equipped with FireBug, but it doesn't matter) the following code:


Now we have added extra div to the end of the list, but that div is not draggable.

Or maybe it's the matter of the way the extra div being added (i.e., my mistake)?

Dec 16, 2009 at 10:30 AM
Edited Dec 16, 2009 at 10:58 AM

Your example worked for me in Firefox (this is how the binding works). The one thing I forgot to mention in the release notes (just added now) is that I'm unable to automatically style newly added items with the pointer cursor since basically this code gets called:

$("#list1 li").css("cursor", "pointer");

So of course items added later won't have that style attribute added, so that CSS now needs to be added as part of your stylesheet to make it obvious that the newly added items can be dragged. However now that I think about it there's no reason why I can't add that CSS myself to the head tag using javascript (although it will only work if css selectors used for the list and dragHandler are supported by the browser). So I've created a pending release that now does this:

If this doesn't explain your issue I might need more details.

Dec 16, 2009 at 4:57 PM
Edited Dec 16, 2009 at 4:57 PM

Tested in Firefox 3.5.5 (linux) and Firefox 3.5.6 (windows) using the example page (example.html) which comes out-of-box with every release:

v3.8 do NOT allow to drag newly added LI-item (sure, applying cursor style doesn't change the situation). Maybe wrong version went to release?

v3.9 ALLOWS to drag newly added items and do not requires applying cursor styles but dragging is accompanied with strange visual glitch. Glitch can be observer even in original version of example.html without any DOM modification (it can be observed in IE8 also). Maybe this caused by changes in placeHolderTemplate made in v3.8?




Dec 16, 2009 at 7:40 PM
Edited Dec 16, 2009 at 11:25 PM

Indeed you are correct v3.8 that's uploaded is an earlier version with only some of the changes mentioned in the release notes implemented. I apologise for this and thanks for bringing it to my attention, I will sort this out when I have some more time.

I've updated v3.9 again, I didn't clean up example.html properly from playing around before uploading.

Dec 17, 2009 at 8:53 AM

The latest version works fine! Thanks for the great plugin!