Dave Methvin schrieb:
> On 10/31/06, *Pascal* <[EMAIL PROTECTED] <mailto:[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?

Such nodeLists are kind of arrays, but immutable. I don't know what 
jQuery does to an array like element passed to $(). If its trying to 
alter the passed in array that won't work...

To verify this one could try:

var elems = [];
for (var i = 0; i < theForm.elements.length; i++)
     elems.push(theForm.elements[i]);

alert( $(elems) );


-- Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to