I know the scenario would be uncommon and while I was working with
someone's code, some event on the page calls a function and passes an
array which then is used in this function like this:
jQuery.each(arr, function() {
});
At some point the array coming in is not an array but is undefined
which causes this error. This could be checked before using each, but
though it might be a good idea to check within each.
try this just for fun:
var arr;
jQuery.each(arr, function() {
});
On Feb 25, 8:25 pm, Steven Black <[email protected]> wrote:
> Do you have a test case for this one?
>
> I have a hard-time imagining the scenario you describe when jQuery is
> invoked properly.
>
> I'm guessing that, in this particular situation, the object of
> discourse isn't actually a jWuery object. In other words, try
>
> $(myVar).each(...)
> instead of
> myvar.each(...)
>
> I'm guessing <s>.
>
> **--** Steve
>
> On Feb 25, 8:03 pm, pbcomm <[email protected]> wrote:
>
> > If the object passed into jQuery.each is null or undefined you get an
> > error at object.length on the first line. Maybe there should be a
> > check if (object == null) return object;? What do we think?