You can keep your own unique identifier anywhere you want, for data() the identifier is the element itself. If you care to explain a bit more of what you're trying to achieve someone might come up with an useful suggestion. What did 'elem' refer to in your original script for example? A DOM element?
- ricardo On Dec 16, 6:46 am, ricardoe <ricar...@gmail.com> wrote: > Well, solved issue: > > Don't trust jQuery.data(element) if you're pretending to use gQuery > (element).data('only-data-element','something')!!!! > When you use gQuery(element).removeData('only-data-element') the > jQuery.cache for that element will be deleted. > This leads that when you do again jQuery.data(element) you WONT have > the expected ID, it will create a new one. > > Why?! I dunno. But I'll not file a ticket cause "most of people > doesn't use it that way"...... lame. > > On Dec 16, 1:39 am, ricardoe <ricar...@gmail.com> wrote: > > > Hi, > > > Does anyone knows why this: > > > var id = elem[ expando ]; > > // Compute a unique ID for the element > > if ( !id ) { > > id = elem[expando] = ++uuid; > > } > > > Could be being broken? I mean, on a test page I made the elem[expando] > > property is not being "saved". > > I'll explain, the first time I do jQuery.data(element) I get a number > > lets say: 10. > > Then if I do again the same (with the exactly same element) I get: 14. > > > I'm using this to identify elements so its not working as expected, > > anyone have theories about this?