[whatwg] Structured Clone of Map and Set objects

Oliver Hunt oliver at apple.com
Wed Sep 4 11:56:32 PDT 2013

The current structured clone algorithm does not include support for the Map and Set types, so a developer would need to manually implement the serialisation and deserialisation.  While this would not be impossible it does seem like it is an unnecessary inconvenience for a core type in ES6.

The semantics of Map and Set are stable so unless someone objects i see no reason we should not amend the internal structured clone algorithm to specially handle Set and Map in addition to Array.  To support cloning of Map and Set we will want to recursively call the structured clone algorithm on each key or key/value pair in the %SetData% or %MapData% internal arrays, and maintain the order of those entries (as the Map/Set ordering is well defined)


More information about the whatwg mailing list