Thanks mike

On Aug 29, 3:21 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> > From: Pops
>
> > This might be slightly off topic, a javascript script
> > question, but its being applied to jQuery. :-)
>
> > Ok, there is a different in other languages when you do this:
>
> >        var p = null;
> >        xyz(null);
> >        xyx(p);
>
> > It depends on the function prototype and how a language binds
> > to the function..
>
> > In JavaScript, what is passed to the function xyz:
>
> > The address of p or the value of p.
>
> Object, Array, and Function arguments are passed by reference; other types
> such as Number and String are passed by value.
>
> null is an Object and is passed by reference. (There is only one null
> object.)
>
> In your example, the two calls to xyz() are identical. Both pass the same
> null object into the function.
>
> > I ask because in the jQuery XHR implementation, it has this
>
> >      xml.send(s.data);
>
> > And s.data is set to null if s.type is "get"
>
> > So I am wondering if it safe to assume the user's agent
> > external prototype for send() expects:
>
> >     -   an asciiz string
>
> >     -   OLE string (like BSTR) like its normally done in
> > Windows's OLE/
> > ActiveX/COM/DCOM
> >         RPC interfacing
>
> The standard calls for the argument to send() to be a DOMString, a Document,
> null, or omitted. Any other type is converted to a DOMString if possible,
> otherwise treated as null:
>
> http://www.w3.org/TR/XMLHttpRequest/#dfn-send
>
> > Of course, if you are not sure, its always to be safe and do:
>
> >        xml.send(( s.type.toLowerCase() == "get" )?null:s.data);
>
> Just as in your xyz() example, if s.data is null, then these two calls are
> identical:
>
>    xml.send( null );
>    xml.send( s.data );
>
> So the extra code isn't necessary.
>
> -Mike

Reply via email to