[html5] r8374 - [giow] (0) Define structured cloning for Map and Set Fixing https://www.w3.org/B [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Jan 3 16:08:04 PST 2014


Author: ianh
Date: 2014-01-03 16:08:01 -0800 (Fri, 03 Jan 2014)
New Revision: 8374

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Define structured cloning for Map and Set
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=23892
Affected topics: DOM APIs, HTML

Modified: complete.html
===================================================================
--- complete.html	2014-01-03 22:57:04 UTC (rev 8373)
+++ complete.html	2014-01-04 00:08:01 UTC (rev 8374)
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 3 January 2014</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 4 January 2014</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -8156,7 +8156,7 @@
    <li><p>If <var title="">input</var> is a primitive value, then return that value and abort these
    steps.</li>
 
-   <li><p>Let <var title="">deep clone</var> be false.</li>
+   <li><p>Let <var title="">deep clone</var> be <i>none</i>.</li>
 
    <li>
 
@@ -8246,7 +8246,7 @@
 
 <!--CLEANUP-->
       <p>Let <var title="">output</var> be a newly constructed empty <code>Array</code> object whose
-      <code title="">length</code> is equal to the <code title="">length</code> of <var title="">input</var>, and set <var title="">deep clone</var> to true.</p>
+      <code title="">length</code> is equal to the <code title="">length</code> of <var title="">input</var>, and set <var title="">deep clone</var> to <i>own</i>.</p>
 
       <p class=note>This means that the length of sparse arrays is preserved.</p>
 
@@ -8256,8 +8256,18 @@
 
 <!--CLEANUP-->
      <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Object</code>
-     object, and set <var title="">deep clone</var> to true.</dd>
+     object, and set <var title="">deep clone</var> to <i>own</i>.</dd>
 
+     <dt>If <var title="">input</var> is a <code><a href=#the-map-element>Map</a></code> object</dt>
+
+     <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Map</code>
+     object, and set <var title="">deep clone</var> to <i><a href=#the-map-element>map</a></i>.</dd>
+
+     <dt>If <var title="">input</var> is a <code>Set</code> object</dt>
+
+     <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Set</code>
+     object, and set <var title="">deep clone</var> to <i>set</i>.</dd>
+
      <dt>If <var title="">input</var> is an object that another specification defines how to clone</dt>
 
      <dd><p>Let <var title="">output</var> be a clone of the object as defined by the other
@@ -8282,8 +8292,71 @@
 
    <li>
 
-    <p>If <var title="">deep clone</var> is set, then, for each enumerable own property in <var title="">input</var>, run the following steps:</p>
+    <p>If <var title="">deep clone</var> is set to <i><a href=#the-map-element>map</a></i>, then run these substeps. These
+    substeps use the terminology and typographic conventions used in the JavaScript specification's
+    definition of Maps. <a href=#refsECMA262>[ECMA262]</a></p>
 
+    <ol><li><p>Let <var title="">source</var> be the List that is the value of <var title="">input</var>'s [[MapData]] internal slot, if any. If there is no such slot, then
+     instead throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone>structured
+     clone</a> algorithm. <a href=#refsECMA262>[ECMA262]</a></li>
+
+     <li><p>Let <var title="">target</var> be the List that is the value of <var title="">output</var>'s [[MapData]] internal slot.</li>
+
+     <li>
+
+      <p>For each Record {[[key]], [[value]]} <var title="">entry</var> that is an element of
+      <var title="">source</var>, run the following substeps:</p>
+
+      <ol><li><p>Let <var title="">key</var> have the value obtained from invoking the
+       <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with <var title="">entry</var>.[[key]] as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</li>
+
+       <li><p>Let <var title="">value</var> have the value obtained from invoking the
+       <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with <var title="">entry</var>.[[value]] as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</li>
+
+       <li><p>Let <var title="">new entry</var> be the Record {[[key]]: <var title="">key</var>,
+       [[value]]: <var title="">value</var>}.</li>
+
+       <li><p>Append <var title="">new entry</var> as the last element of <var title="">target</var>.</li>
+
+      </ol></li>
+
+     <li><p>Set <var title="">deep clone</var> to <i>own</i>.</li>
+
+    </ol></li>
+
+   <li>
+
+    <p>If <var title="">deep clone</var> is set to <i>set</i>, then run these substeps. These
+    substeps use the terminology and typographic conventions used in the JavaScript specification's
+    definition of Sets. <a href=#refsECMA262>[ECMA262]</a></p>
+
+    <ol><li><p>Let <var title="">source</var> be the List that is the value of <var title="">input</var>'s [[SetData]] internal slot, if any. If there is no such slot, then
+     instead throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone>structured
+     clone</a> algorithm. <a href=#refsECMA262>[ECMA262]</a></li>
+
+     <li><p>Let <var title="">target</var> be the List that is the value of <var title="">output</var>'s [[SetData]] internal slot.</li>
+
+     <li>
+
+      <p>For each <var title="">entry</var> that is an element of <var title="">source</var> that
+      is not <i>empty</i>, run the following substeps:</p>
+
+      <ol><li><p>Let <var title="">new entry</var> have the value obtained from invoking the
+       <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with <var title="">entry</var> as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</li>
+
+       <li><p>Append <var title="">new entry</var> as the last element of <var title="">target</var>.</li>
+
+      </ol></li>
+
+     <li><p>Set <var title="">deep clone</var> to <i>own</i>.</li>
+
+    </ol></li>
+
+   <li>
+
+<!--CLEANUP-->
+    <p>If <var title="">deep clone</var> is set to <i>own</i>, then, for each enumerable own property in <var title="">input</var>, run the following steps:</p>
+
     <ol><li><p>Let <var title="">name</var> be the name of the property.</li>
 
 <!--CLEANUP-->
@@ -101664,7 +101737,7 @@
    <dd><cite>Recommendation E.163 — Numbering Plan for The International Telephone Service</cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.</dd>
 
    <dt id=refsECMA262>[ECMA262]</dt>
-   <dd><cite><a href=http://www.ecma-international.org/publications/standards/Ecma-262.htm>ECMAScript Language Specification</a></cite>. ECMA.</dd>
+   <dd><cite><a href=http://people.mozilla.org/~jorendorff/es6-draft.html>ECMAScript Language Specification</a></cite>. ECMA.</dd>
 
    <dt id=refsECMA357>[ECMA357]</dt>
    <dd>(Non-normative) <cite><a href=http://www.ecma-international.org/publications/standards/Ecma-357.htm>ECMAScript for XML (E4X) Specification</a></cite>. ECMA.</dd>

Modified: index
===================================================================
--- index	2014-01-03 22:57:04 UTC (rev 8373)
+++ index	2014-01-04 00:08:01 UTC (rev 8374)
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 3 January 2014</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 4 January 2014</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -8156,7 +8156,7 @@
    <li><p>If <var title="">input</var> is a primitive value, then return that value and abort these
    steps.</li>
 
-   <li><p>Let <var title="">deep clone</var> be false.</li>
+   <li><p>Let <var title="">deep clone</var> be <i>none</i>.</li>
 
    <li>
 
@@ -8246,7 +8246,7 @@
 
 <!--CLEANUP-->
       <p>Let <var title="">output</var> be a newly constructed empty <code>Array</code> object whose
-      <code title="">length</code> is equal to the <code title="">length</code> of <var title="">input</var>, and set <var title="">deep clone</var> to true.</p>
+      <code title="">length</code> is equal to the <code title="">length</code> of <var title="">input</var>, and set <var title="">deep clone</var> to <i>own</i>.</p>
 
       <p class=note>This means that the length of sparse arrays is preserved.</p>
 
@@ -8256,8 +8256,18 @@
 
 <!--CLEANUP-->
      <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Object</code>
-     object, and set <var title="">deep clone</var> to true.</dd>
+     object, and set <var title="">deep clone</var> to <i>own</i>.</dd>
 
+     <dt>If <var title="">input</var> is a <code><a href=#the-map-element>Map</a></code> object</dt>
+
+     <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Map</code>
+     object, and set <var title="">deep clone</var> to <i><a href=#the-map-element>map</a></i>.</dd>
+
+     <dt>If <var title="">input</var> is a <code>Set</code> object</dt>
+
+     <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Set</code>
+     object, and set <var title="">deep clone</var> to <i>set</i>.</dd>
+
      <dt>If <var title="">input</var> is an object that another specification defines how to clone</dt>
 
      <dd><p>Let <var title="">output</var> be a clone of the object as defined by the other
@@ -8282,8 +8292,71 @@
 
    <li>
 
-    <p>If <var title="">deep clone</var> is set, then, for each enumerable own property in <var title="">input</var>, run the following steps:</p>
+    <p>If <var title="">deep clone</var> is set to <i><a href=#the-map-element>map</a></i>, then run these substeps. These
+    substeps use the terminology and typographic conventions used in the JavaScript specification's
+    definition of Maps. <a href=#refsECMA262>[ECMA262]</a></p>
 
+    <ol><li><p>Let <var title="">source</var> be the List that is the value of <var title="">input</var>'s [[MapData]] internal slot, if any. If there is no such slot, then
+     instead throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone>structured
+     clone</a> algorithm. <a href=#refsECMA262>[ECMA262]</a></li>
+
+     <li><p>Let <var title="">target</var> be the List that is the value of <var title="">output</var>'s [[MapData]] internal slot.</li>
+
+     <li>
+
+      <p>For each Record {[[key]], [[value]]} <var title="">entry</var> that is an element of
+      <var title="">source</var>, run the following substeps:</p>
+
+      <ol><li><p>Let <var title="">key</var> have the value obtained from invoking the
+       <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with <var title="">entry</var>.[[key]] as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</li>
+
+       <li><p>Let <var title="">value</var> have the value obtained from invoking the
+       <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with <var title="">entry</var>.[[value]] as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</li>
+
+       <li><p>Let <var title="">new entry</var> be the Record {[[key]]: <var title="">key</var>,
+       [[value]]: <var title="">value</var>}.</li>
+
+       <li><p>Append <var title="">new entry</var> as the last element of <var title="">target</var>.</li>
+
+      </ol></li>
+
+     <li><p>Set <var title="">deep clone</var> to <i>own</i>.</li>
+
+    </ol></li>
+
+   <li>
+
+    <p>If <var title="">deep clone</var> is set to <i>set</i>, then run these substeps. These
+    substeps use the terminology and typographic conventions used in the JavaScript specification's
+    definition of Sets. <a href=#refsECMA262>[ECMA262]</a></p>
+
+    <ol><li><p>Let <var title="">source</var> be the List that is the value of <var title="">input</var>'s [[SetData]] internal slot, if any. If there is no such slot, then
+     instead throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone>structured
+     clone</a> algorithm. <a href=#refsECMA262>[ECMA262]</a></li>
+
+     <li><p>Let <var title="">target</var> be the List that is the value of <var title="">output</var>'s [[SetData]] internal slot.</li>
+
+     <li>
+
+      <p>For each <var title="">entry</var> that is an element of <var title="">source</var> that
+      is not <i>empty</i>, run the following substeps:</p>
+
+      <ol><li><p>Let <var title="">new entry</var> have the value obtained from invoking the
+       <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with <var title="">entry</var> as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</li>
+
+       <li><p>Append <var title="">new entry</var> as the last element of <var title="">target</var>.</li>
+
+      </ol></li>
+
+     <li><p>Set <var title="">deep clone</var> to <i>own</i>.</li>
+
+    </ol></li>
+
+   <li>
+
+<!--CLEANUP-->
+    <p>If <var title="">deep clone</var> is set to <i>own</i>, then, for each enumerable own property in <var title="">input</var>, run the following steps:</p>
+
     <ol><li><p>Let <var title="">name</var> be the name of the property.</li>
 
 <!--CLEANUP-->
@@ -101664,7 +101737,7 @@
    <dd><cite>Recommendation E.163 — Numbering Plan for The International Telephone Service</cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.</dd>
 
    <dt id=refsECMA262>[ECMA262]</dt>
-   <dd><cite><a href=http://www.ecma-international.org/publications/standards/Ecma-262.htm>ECMAScript Language Specification</a></cite>. ECMA.</dd>
+   <dd><cite><a href=http://people.mozilla.org/~jorendorff/es6-draft.html>ECMAScript Language Specification</a></cite>. ECMA.</dd>
 
    <dt id=refsECMA357>[ECMA357]</dt>
    <dd>(Non-normative) <cite><a href=http://www.ecma-international.org/publications/standards/Ecma-357.htm>ECMAScript for XML (E4X) Specification</a></cite>. ECMA.</dd>

Modified: source
===================================================================
--- source	2014-01-03 22:57:04 UTC (rev 8373)
+++ source	2014-01-04 00:08:01 UTC (rev 8374)
@@ -7753,7 +7753,7 @@
    <li><p>If <var data-x="">input</var> is a primitive value, then return that value and abort these
    steps.</p></li>
 
-   <li><p>Let <var data-x="">deep clone</var> be false.</p></li>
+   <li><p>Let <var data-x="">deep clone</var> be <i>none</i>.</p></li>
 
    <li>
 
@@ -7858,7 +7858,7 @@
 <!--CLEANUP-->
       <p>Let <var data-x="">output</var> be a newly constructed empty <code>Array</code> object whose
       <code data-x="">length</code> is equal to the <code data-x="">length</code> of <var
-      data-x="">input</var>, and set <var data-x="">deep clone</var> to true.</p>
+      data-x="">input</var>, and set <var data-x="">deep clone</var> to <i>own</i>.</p>
 
       <p class="note">This means that the length of sparse arrays is preserved.</p>
 
@@ -7868,8 +7868,18 @@
 
 <!--CLEANUP-->
      <dd><p>Let <var data-x="">output</var> be a newly constructed empty <code data-x="">Object</code>
-     object, and set <var data-x="">deep clone</var> to true.</p></dd>
+     object, and set <var data-x="">deep clone</var> to <i>own</i>.</p></dd>
 
+     <dt>If <var data-x="">input</var> is a <code>Map</code> object</dt>
+
+     <dd><p>Let <var data-x="">output</var> be a newly constructed empty <code data-x="">Map</code>
+     object, and set <var data-x="">deep clone</var> to <i>map</i>.</p></dd>
+
+     <dt>If <var data-x="">input</var> is a <code>Set</code> object</dt>
+
+     <dd><p>Let <var data-x="">output</var> be a newly constructed empty <code data-x="">Set</code>
+     object, and set <var data-x="">deep clone</var> to <i>set</i>.</p></dd>
+
      <dt>If <var data-x="">input</var> is an object that another specification defines how to clone</dt>
 
      <dd><p>Let <var data-x="">output</var> be a clone of the object as defined by the other
@@ -7900,7 +7910,98 @@
 
    <li>
 
-    <p>If <var data-x="">deep clone</var> is set, then, for each enumerable own property in <var
+    <p>If <var data-x="">deep clone</var> is set to <i>map</i>, then run these substeps. These
+    substeps use the terminology and typographic conventions used in the JavaScript specification's
+    definition of Maps. <a href="#refsECMA262">[ECMA262]</a></p>
+
+    <ol>
+
+     <li><p>Let <var data-x="">source</var> be the List that is the value of <var
+     data-x="">input</var>'s [[MapData]] internal slot, if any. If there is no such slot, then
+     instead throw a <code>DataCloneError</code> exception and abort the overall <span>structured
+     clone</span> algorithm. <a href="#refsECMA262">[ECMA262]</a></p></li>
+
+     <li><p>Let <var data-x="">target</var> be the List that is the value of <var
+     data-x="">output</var>'s [[MapData]] internal slot.</p></li>
+
+     <li>
+
+      <p>For each Record {[[key]], [[value]]} <var data-x="">entry</var> that is an element of
+      <var data-x="">source</var>, run the following substeps:</p>
+
+      <ol>
+
+       <li><p>Let <var data-x="">key</var> have the value obtained from invoking the
+       <span>internal structured cloning algorithm</span> recursively with <var
+       data-x="">entry</var>.[[key]] as the new "<var data-x="">input</var>" argument and <var
+       data-x="">memory</var> as the new "<var data-x="">memory</var>" argument.</p></li>
+
+       <li><p>Let <var data-x="">value</var> have the value obtained from invoking the
+       <span>internal structured cloning algorithm</span> recursively with <var
+       data-x="">entry</var>.[[value]] as the new "<var data-x="">input</var>" argument and <var
+       data-x="">memory</var> as the new "<var data-x="">memory</var>" argument.</p></li>
+
+       <li><p>Let <var data-x="">new entry</var> be the Record {[[key]]: <var data-x="">key</var>,
+       [[value]]: <var data-x="">value</var>}.</p></li>
+
+       <li><p>Append <var data-x="">new entry</var> as the last element of <var
+       data-x="">target</var>.</p></li>
+
+      </ol>
+
+     </li>
+
+     <li><p>Set <var data-x="">deep clone</var> to <i>own</i>.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li>
+
+    <p>If <var data-x="">deep clone</var> is set to <i>set</i>, then run these substeps. These
+    substeps use the terminology and typographic conventions used in the JavaScript specification's
+    definition of Sets. <a href="#refsECMA262">[ECMA262]</a></p>
+
+    <ol>
+
+     <li><p>Let <var data-x="">source</var> be the List that is the value of <var
+     data-x="">input</var>'s [[SetData]] internal slot, if any. If there is no such slot, then
+     instead throw a <code>DataCloneError</code> exception and abort the overall <span>structured
+     clone</span> algorithm. <a href="#refsECMA262">[ECMA262]</a></p></li>
+
+     <li><p>Let <var data-x="">target</var> be the List that is the value of <var
+     data-x="">output</var>'s [[SetData]] internal slot.</p></li>
+
+     <li>
+
+      <p>For each <var data-x="">entry</var> that is an element of <var data-x="">source</var> that
+      is not <i>empty</i>, run the following substeps:</p>
+
+      <ol>
+
+       <li><p>Let <var data-x="">new entry</var> have the value obtained from invoking the
+       <span>internal structured cloning algorithm</span> recursively with <var
+       data-x="">entry</var> as the new "<var data-x="">input</var>" argument and <var
+       data-x="">memory</var> as the new "<var data-x="">memory</var>" argument.</p></li>
+
+       <li><p>Append <var data-x="">new entry</var> as the last element of <var
+       data-x="">target</var>.</p></li>
+
+      </ol>
+
+     </li>
+
+     <li><p>Set <var data-x="">deep clone</var> to <i>own</i>.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li>
+
+<!--CLEANUP-->
+    <p>If <var data-x="">deep clone</var> is set to <i>own</i>, then, for each enumerable own property in <var
     data-x="">input</var>, run the following steps:</p>
 
     <ol>
@@ -113558,8 +113659,7 @@
    <dd><cite>Recommendation E.163 — Numbering Plan for The International Telephone Service</cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.</dd>
 
    <dt id="refsECMA262">[ECMA262]</dt>
-   <dd><cite><a
-   href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript Language Specification</a></cite>. ECMA.</dd>
+   <dd><cite><a href="http://people.mozilla.org/~jorendorff/es6-draft.html">ECMAScript Language Specification</a></cite>. ECMA.</dd>
 
    <dt id="refsECMA357">[ECMA357]</dt>
    <dd>(Non-normative) <cite><a href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">ECMAScript for XML (E4X) Specification</a></cite>. ECMA.</dd>




More information about the Commit-Watchers mailing list