On 10/31/06, Pascal <[EMAIL PROTECTED]> wrote:
I'm trying to do some jQuery manipulations on a form. A reference to
the form is in the variable 'theForm'. the following generates an
error in Safari:

alert( $(theForm.elements) );

the error generated is:

Value undefined (result of _expression_ f.apply) is not object.
http://mydomain.com/lib/js/jquery/jquery.js  Line 3578

I'm using revision 443 of jQuery.

Anyone have an idea what might be causing this? I have a feeling it
might be related to an earlier discussion about passing/manipulating
nodelists in Safari. If so, was there a resolution to that problem
that might apply here? 
 
I missed your earlier post, Pascal. Yes, I think the problem is in jQuery.clean() where it checks the incoming argument for the .nodeType property. We are trying to separate DOM elements with a length property (which we don't want to enumerate) from DOM nodelist collections (which we do).
 
It might be possible to find some other property that Safari wouldn't find crashingly offensive? Nodelists only have two documented properties, .length and .item. It still seems easier to look for some "not a nodelist" indicator.
 
Something just occurred to me, maybe Safari is upset trying to convert the nodeType to a boolean with the "!" operator. It's saying the value is undefined, and that is correct, so maybe we can check directly for undefined. Perhaps you could try this instead?
 
Change
 
   else if ( arg.length != undefined && !arg.nodeType ) // Handles Array, jQuery, DOM NodeList collections
to
 
   else if ( arg.length != undefined && arg.nodeType == undefined ) // Handles Array, jQuery, DOM NodeList collections
 
 
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to