You mean this: http://dev.jquery.com/ticket/3539

You're right indeed, I forgot queue was blindly executing any queued
data. I was sure it'd only do that for fx queues.
I was confusing it with my patch.

So yes, queuing is only good for functions for now, we'll hopefully
have a nicer queuing system for 1.3.

Shame it's not documented by the way.

As for your situation... I don't think you can retrieve the data
object using $.fn.data, but this should do:

var $elem = $(....);
...
$elem.data('foo','bar');
$elem.data('foo2','bar2');
...
var id = $elem.data();
var obj = $.cache[id];

obj should be: { foo:'bar', foo2:'bar2' };

Haven't tested this though, sorry :)

Note that this object might include other things if you (for example)
bind events to this element.

Cheers

On Fri, Dec 12, 2008 at 1:28 AM, Nick <nschub...@gmail.com> wrote:
>
> Also, I should mention (as I see a patch request for exposing queue)
> that I am working on a fairly large framework and patching in an
> update for one module of the site is not an easy task nor something I
> want to approach someone with at this time.  We are using a more
> recent version of JQuery, but not the latest.
>
> On Dec 11, 10:23 pm, Nick <nschub...@gmail.com> wrote:
>> queue as in effect queue?  I'm not finding any documentation on queue
>> except as used for effects and your sample seems to put items in a
>> queue as if I had to execute things in order.  That's not what I'm
>> looking for.  I need to store key/value pairs to specific elements on
>> the page for nav requests and data() does this perfectly... I
>> currently store they keywords I need in the data element for each list
>> item and pass the list item contents to the navigation functions.  If
>> I can pass a dynamic set of key/value pairs and iterate through the
>> data object to get those values instead of having to know the key,
>> then I can fully utilize the framework I'm working with (suppression
>> flags, navigation keywords, url variables, etc.)
>>
>> I'd hate to have to create a new associative object and pass it when I
>> can append the appropriate data to the element when the page is built
>> and just pass a reference to the element.
>>
>> On Dec 11, 7:28 pm, Ariel Flesler <afles...@gmail.com> wrote:
>>
>> > You need to use $().queue() not data.
>>
>> > $().queue('foo',1).queue('foo',2).queue('foo',3)
>>
>> > Also, $().queue('foo').each() won't work because the returned data is
>> > an array.
>>
>> > $.each($().queue('foo'), function(){ }); will work.
>>
>> > --
>> > Ariel Fleslerhttp://flesler.blogspot.com/
>>
>> > On Dec 11, 7:42 pm, Nick <nschub...@gmail.com> wrote:
>>
>> > > Does anyone know how I can iterate through the elements stored in the
>> > > data element instead of referring to them individually?
>>
>> > > Say I:
>> > > $(someObj).data('myData1', 'Here is some text')
>> > > .data('myData2', 'Here is some more text')
>> > > .data('myG', 'Here is some more text');
>>
>> > > How could I loop through the data() object to get the key/value pairs
>> > > back if I didn't know the keys?
>>
>> > > I tried:
>> > > $(someObj).data().each(function(i, val) { alert(i + ': ' + val); });
>>
>> > > with no success.  I also tried variations of for loops and such.
>>
>>
> >
>



-- 
Ariel Flesler
http://flesler.blogspot.com

Reply via email to