Re: order of arguments in window.postMessage()

On Thu, 14 Jan 2010, Simon Pieters wrote:
>
> What's the rationale for the order of the arguments in 
> window.postMessage(message, ports, targetOrigin)?

The idea was to keep the order of the arguments so that message parameters 
came before target conditions, so that the two methods were "message, 
target" and "message, message, target" rather than the second being 
"message, target, message".

If we had planned for MessagePorts when first doing postMessage(), I'd 
have probably put the target parameter first to avoid the problem.


> Can it be changed to message, targetOrigin, ports?

Done, provisionally. If this breaks sites that use the ports argument, 
I'll change it back.


BTW, at some point relatively soon I'll collapse the two postMessage() 
methods and the algorithms that define them into a single method with one 
algorithm (without changing any of the requirements) -- the reason we have 
two for now is that Anne asked that the one with ports not be merged with 
the one without ports until the one without ports was more widely 
implemented, so as to not confuse implementors.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 25 March 2010 23:57:53 UTC