send() argument

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

send() argument

Hallvord Reiar Michaelsen Steen-3

 From the section on XHR.send(data)

> data is not a DOMString or DocumentThe stringification mechanisms of the  
> host language must be used on
> data and the result must be treated as if data is a DOMString.

A nice feature in Opera's implementation is that you can pass any Node to  
send, and Opera sends the serialisation. I think that is very useful and  
really wouldn't like it to be made nonconformant by the spec.

Example:

client.open('POST', 'foo.cgi');
client.send( document.getElementById('bar') );

--
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience

Reply | Threaded
Open this post in threaded view
|

Re: send() argument

Bjoern Hoehrmann

* Hallvord R. M. Steen wrote:
>A nice feature in Opera's implementation is that you can pass any Node to  
>send, and Opera sends the serialisation. I think that is very useful and  
>really wouldn't like it to be made nonconformant by the spec.
>
>Example:
>
>client.open('POST', 'foo.cgi');
>client.send( document.getElementById('bar') );

And what is supposed to happen if the Node is an attribute node, or a
document fragment, or an entity reference? In particular, which MIME
type should be inferred from the content? And what if the Node is a
HTMLElement? What do you suggest should user agents do for code as you
have it above if they do not support sending arbitrary Nodes?
--
Björn Höhrmann · mailto:[hidden email] · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Reply | Threaded
Open this post in threaded view
|

Re: send() argument

Simon Pieters-2
In reply to this post by Hallvord Reiar Michaelsen Steen-3

On Thu, 22 Feb 2007 09:25:00 +0100, Hallvord R. M. Steen  
<[hidden email]> wrote:

> A nice feature in Opera's implementation is that you can pass any Node  
> to send, and Opera sends the serialisation. I think that is very useful  
> and really wouldn't like it to be made nonconformant by the spec.
>
> Example:
>
> client.open('POST', 'foo.cgi');
> client.send( document.getElementById('bar') );
>

Why can't you use:

    client.open('POST', 'foo.cgi');
    client.send( document.getElementById('bar').innerHTML );

...?

--
Simon Pieters

Reply | Threaded
Open this post in threaded view
|

Re: send() argument

Hallvord Reiar Michaelsen Steen-3

On Thu, 22 Feb 2007 20:01:46 +0100, Simon Pieters <[hidden email]>  
wrote:

>> A nice feature in Opera's implementation is that you can pass any Node  
>> to send, and Opera sends the serialisation. I think that is very useful  
>> and really wouldn't like it to be made nonconformant by the spec.
>>
>> Example:
>>
>> client.open('POST', 'foo.cgi');
>> client.send( document.getElementById('bar') );
>>
>
> Why can't you use:
>
>     client.open('POST', 'foo.cgi');
>     client.send( document.getElementById('bar').innerHTML );
>
> ...?


The equivalent would be .outerHTML which is somewhat less widely supported  
than .innerHTML (no Gecko support).


--
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience