touch-dnd
touch-dnd copied to clipboard
toArray() custom attribute
There's a little issue with toArray() method. If you use custom attribute like 'data-foobar' you always get an 'undefined' for every element and returned array is just a bunch of commas. Problem's with this line:
attrs.push($(this).prop(attr))
'data-foobar' is an attribute, not property. At least, that was in my case. I changed it to this:
attrs.push($(this).attr(attr))
and it started working properly. Might be worth looking into.
UPD:
In case you still have interest in your script, I ended up with this code:
if ($(this).attr(attr)) {
attrs.push($(this).attr(attr))
}