> I added a test for a[0] == undefined instead of checking
> the a.length property. I don't know of a situation where
> a[0] would be anything else if it is a function being passed
> to jQuery.

Technically, anybody can take a function object and assign a value to a
property named "0", but I would call it a pathological case.

> However, I also forgot completely about the .length property

Me too. That explains how Safari was getting into the array-like case in
jQuery.clean with a function object.

>> (from jQuery.js)  typeof a == "function" && !a.nodeType

Doesn't that tickle the same Safari bug where it exploded in jQuery.clean?
I'm flying blind on Safari so I can't tell.

> ... so hopefully someone can chime in and verfiy that a[0]
> will always be undefined if a function is passed in for 'a' or
> with another way to allow a nodelist that safari thinks is a
> function to fall through.

We can't guarantee that someone didn't assign a "0" property to their
function, but I say we let that one slide. Duck typing is not an exact
science.

BTW, the same check wouldn't work for jQuery.clean because it's okay to pass
an empty Array there, and a[0] would rightfully be undefined. In the
jQuery() code you're only making that a[0]==undefined check after the lying
sack of object says it's a function.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to