I noticed HTML DOM defines a setAttribute method and it looks like this is defined for arbitrary attribute name. However this can only set string values. (You can of course use this to store keys into a dictionary.)
Specifics (though I’m mostly interested in the general question):
Specifically, I have HTML elements representing nodes in a tree and I’m trying to enable drag-and-drop, but the jQuery drop event will only give me the elements being dragged and dropped.
Have you looked at the jQuery data() method? You can assign complex objects to the element if you want or you can leverage that method to hold a reference to an object (or some other data) at the very least.
var div= document.getElementById('nav'); div.potato= ['lemons', 3];