W3C home > Mailing lists > Public > public-html@w3.org > March 2010

Re: order of arguments in window.postMessage()

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 25 Mar 2010 23:57:24 +0000 (UTC)
To: Simon Pieters <simonp@opera.com>
Cc: "public-html@w3.org" <public-html@w3.org>, atwilson@google.com
Message-ID: <Pine.LNX.4.64.1003252351260.29348@ps20323.dreamhostps.com>
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

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:14 UTC