Thanks for not posting this to the bug tracker! A test case is helpful
even in the forums though.

> FireBug is reporting this error.
> jquery.js (line 3633)
> object is undefined
> [Break on this error] var name, i = 0, length = object.length;\n
> I am using jQuery 1.3.2

That looks like the first line of jQuery.each, although the line
number you gave doesn't seem to match. It's line 672 of my
uncompressed jQuery 1.3.2 right off the site. I think it makes sense
for that line to be the one where it dies. Because...

> for(var i = 0; i<verbArray.length; i++){
>    var verbTime = Math.floor(Math.random()*1000);
>    jQuery("#verb-content").fadeOut(verbTime, function(){
>       jQuery(that).text(verbArray[i]).fadeIn(verbTime);
>    });
>  }

Each time through the loop you're queueing up a fadeOut animation.
Each animation has a *callback* that uses the variable i from the
closure. By the time any of those callbacks execute sometime in the
future, the loop has long since finished; at that point
i==verbArray.length and verbArray[i] is undefined for every one of
them.

As a result, if DBJDBJ is right and "that" is actually the window
object, then inside .text() it's trying to call jQuery.each
(window.childNodes, ...) which would give the error you saw
because...well, because window.childNodes is undefined! You should be
able to see the call stack in Firebug to verify that's what is
happening.

If you converted your for loops to jQuery.each loops, you should be
able to get the closure you need to make this work properly.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to