W3C home > Mailing lists > Public > public-html-diffs@w3.org > October 2011

postmsg; hixie: Make postMessage() accept the second and third arguments in either order. Compat with WebKit and hopefully solves the difficulty people have about remembering which goes first. (whatwg r6690)

From: poot <cvsmail@w3.org>
Date: Mon, 17 Oct 2011 17:51:18 -0400
To: public-html-diffs@w3.org
Message-Id: <E1RFv5Z-0007fz-TM@jay.w3.org>
postmsg; hixie: Make postMessage() accept the second and third arguments
in either order. Compat with WebKit and hopefully solves the difficulty
people have about remembering which goes first. (whatwg r6690)

http://dev.w3.org/cvsweb/html5/postmsg/Overview.html?r1=1.101&r2=1.102&f=h
http://html5.org/tools/web-apps-tracker?from=6689&to=6690

===================================================================
RCS file: /sources/public/html5/postmsg/Overview.html,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- Overview.html	7 Oct 2011 22:01:50 -0000	1.101
+++ Overview.html	17 Oct 2011 21:50:59 -0000	1.102
@@ -215,7 +215,7 @@
 
    <h1>HTML5 Web Messaging</h1>
    
-   <h2 class="no-num no-toc" id="editor-s-draft-7-october-2011">Editor's Draft 7 October 2011</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-17-october-2011">Editor's Draft 17 October 2011</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/webmessaging/">http://www.w3.org/TR/webmessaging/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -317,7 +317,7 @@
   </dl><p>The W3C <a href="http://www.w3.org/2008/webapps/">Web Applications
   Working Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation track.
-  This specification is the 7 October 2011 Editor's Draft.
+  This specification is the 17 October 2011 Editor's Draft.
   </p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
   February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/42538/status" rel="disclosure">public list of
   any patent disclosures</a> made in connection with the deliverables
@@ -589,6 +589,7 @@
   careful to allow access to certain properties but not others.</p>
 
   </div><h3 id="posting-messages"><span class="secno">4.3 </span>Posting messages</h3><dl class="domintro"><dt><var title="">window</var> . <code title="dom-window-postMessage"><a href="#dom-window-postmessage">postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">transfer</var> ])</dt>
+   <dt><var title="">window</var> . <code title="dom-window-postMessage"><a href="#dom-window-postmessage">postMessage</a></code>(<var title="">message</var> [, <var title="">transfer</var> ], <var title="">targetOrigin</var>)</dt>
 
    <dd>
 
@@ -605,6 +606,10 @@
     <p>Throws a <code>DataCloneError</code> if <var title="">transfer</var> array contains duplicate objects or if
     <var title="">message</var> could not be cloned.</p>
 
+    <p>The second and third arguments can be given in either order,
+    and the <var title="">transfer</var> array can be omitted
+    entirely.</p>
+
    </dd>
 
   </dl><p class="note">When posting a message to a <code>Window</code> of a
@@ -619,12 +624,33 @@
   their readiness to receive messages, and for the parent to wait for
   this message before beginning posting messages.<div class="impl">
 
-  <p>When a script invokes the <dfn id="dom-window-postmessage" title="dom-window-postMessage"><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">transfer</var>)</code></dfn> method (with two or three
-  arguments) on a <code>Window</code> object, the user agent must
-  follow these steps:</p>
+  <p>When a script invokes the <dfn id="dom-window-postmessage" title="dom-window-postMessage"><code>postMessage()</code></dfn>
+  method (with two or three arguments) on a <code>Window</code>
+  object, the user agent must follow these steps:</p>
 
   <ol><li>
 
+    <p>Let <var title="">message</var> be the first argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">targetOrigin</var> be the second argument if
+    the second argument is a string, or else the third argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">transfer</var> be the second argument if the
+    second argument is an array of <code>Transferable</code> objects,
+    or else the third argument.</p>
+
+   </li>
+
+   <li>
+
     <p>If the value of the <var title="">targetOrigin</var> argument
     is neither a single U+002A ASTERISK character (*), a single U+002F
     SOLIDUS character (/), nor an <span>absolute URL</span>, then
@@ -648,7 +674,8 @@
 
    <li>
 
-    <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
+    <p>If the method was invoked with three arguments, run these
+    substeps:</p>
 
     <ol><li>
Received on Monday, 17 October 2011 21:51:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 17 October 2011 21:51:23 GMT