[jQuery] Re: jQuery.data() identifier not working

2008-12-17 Thread Ariel Flesler
That's done to avoid memory leaks cleaning up properly. It's not a bug, that's the expected behavior. Cheers -- Ariel Flesler http://flesler.blogspot.com/ On Dec 16, 7:35 pm, ricardoe wrote: > Hi Ricardo > > Yeah, its a DOM element to be more specific I'm working with a lot of > IMG elements.

[jQuery] Re: jQuery.data() identifier not working

2008-12-16 Thread Ricardo Tomasi
Yes, I understood that. That's why I said you can keep an unique ID somewhere else, because the one created by data() can't be used: //create an unique ID var generateID = function(){ var uid = 0; return function(){ return uid++ }; } //save it somewhere $('img').data('id',id) or $('img').a

[jQuery] Re: jQuery.data() identifier not working

2008-12-16 Thread ricardoe
Hi Ricardo Yeah, its a DOM element to be more specific I'm working with a lot of IMG elements. I need to identify them uniquely, (because sometimes the image is repeated, but I need to manage them as different objects), so when I read the documentation for jQuery.data() I (maybe mis-)understand t

[jQuery] Re: jQuery.data() identifier not working

2008-12-16 Thread Ricardo Tomasi
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 elemen

[jQuery] Re: jQuery.data() identifier not working

2008-12-16 Thread ricardoe
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