[13] [DFN[[RUBYB[[RUBY[構造化][こうぞうか]]クローン]@en[structured clone]]]]は、 [[JavaScript]]/[[DOM]]
[[オブジェクト]]の[[深い複製]]操作です。

[83] 
長らく定義されていた「構造化クローン」演算は、
分割されて[[仕様書]]上の[[規定]]たる概念としては消滅しました。
しかし馴染みがありわかりやすいためか、
廃止後も仕様開発の現場では使われ続けているようですし、
現在も [CITE[HTML Standard]] 仕様書中の注記には歴史的経緯として記載が残っています
[SRC[>>12]]。

* 仕様書

[REFS[
- [12] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2014-09-29 21:18:46 +09:00]] 版) <https://html.spec.whatwg.org/#structured-clone>
]REFS]

* 言語

[FIG(short list)[ [37] 
- [CODE[Transferable]]
]FIG]

* 文脈

[FIG(short list)[ [16] [[構造化クローン]]する場面
- [CODE(DOMm)@en[[[postMessage]]]]
- [CODE(DOMm)@en[pushState]]/[CODE(DOMm)@en[replaceState]]
- [[履歴の探索]]

[HISTORY[
- [[URL構文解析器]] ([[Blob URL]])
]HISTORY]
]FIG]

* 歴史

[1] [CITE@en[Structured clones]]
( ([[Anne van Kesteren]] 著, [TIME[2013-04-10 18:45:37 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-script-coord/2013AprJun/0024.html>

[2] [CITE[dslomov-chromium/ecmascript-structured-clone · GitHub]] ([TIME[2013-10-06 04:17:07 +09:00]] 版) <https://github.com/dslomov-chromium/ecmascript-structured-clone>

[3] [CITE[IRC logs: freenode / #whatwg / 20131021]]
( ([TIME[2013-10-23 00:20:09 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20131021>

[4] [CITE@en[Web Applications 1.0 r8310     Prevent dead Blobs and Files from being cloned]]
( ([TIME[2013-11-23 05:18:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8309&to=8310>

[5] [CITE[チェンジセット 155008 – WebKit]]
( ([TIME[2013-12-16 23:17:21 +09:00]] 版))
<http://trac.webkit.org/changeset/155008>

[6] [CITE@en[Bug 23892 – Add Map and Set to the Structured Clone algorithm somehow]]
( ([TIME[2013-12-19 00:40:35 +09:00]] 版))
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=23892>

[7] [CITE[dslomov-chromium/ecmascript-structured-clone]]
( ([TIME[2013-12-18 15:42:27 +09:00]] 版))
<https://github.com/dslomov-chromium/ecmascript-structured-clone>

[8] [CITE@en[Web Applications 1.0 r8374     Define structured cloning for Map and Set]]
( ([TIME[2014-01-04 09:08:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8373&to=8374>

[9] [CITE@en[Typed Array Specification]]
( ([TIME[2014-04-12 22:52:49 +09:00]] 版))
<https://www.khronos.org/registry/typedarray/specs/latest/#CLONING_AND_TRANSFERRING>

[10] [CITE[Add structured cloning as open issue · 2f694f0 · whatwg/fetch]]
( ([TIME[2014-06-13 15:13:10 +09:00]] 版))
<https://github.com/whatwg/fetch/commit/2f694f00345b7d08123d1d03f020b9bd1bcf2ab8>

[11] [CITE@en[Bug 21652 – Should structured clone support FormData?]]
( ([TIME[2014-07-22 09:10:25 +09:00]] 版))
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=21652>

[14] [CITE@en-US[The structured clone algorithm - Web developer guide | MDN]]
( ([TIME[2014-07-23 02:07:22 +09:00]] 版))
<https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/The_structured_clone_algorithm>

[15] [CITE@en[Re: Exposing structured clone as an API?]]
([[Anne van Kesteren]] 著, [TIME[2015-04-24 09:18:38 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0257.html>

[17] [CITE@en[More precisely specify property creation during structured clone · whatwg/html@36073fc]]
([TIME[2015-08-29 15:57:52 +09:00]] 版)
<https://github.com/whatwg/html/commit/36073fc2f36851dbf855ac49017a5829cd77ac7a>

[18] [CITE@en[Avoid side-effects when cloning Maps and Sets · whatwg/html@367707a]]
([TIME[2015-09-02 16:47:57 +09:00]] 版)
<https://github.com/whatwg/html/commit/367707af5cd76864be9224e4b5a769fbf44fed96>

[19] [CITE@en[Fixes and simplification in Map/Set cloning · whatwg/html@6275b07]]
([TIME[2015-09-03 14:55:25 +09:00]] 版)
<https://github.com/whatwg/html/commit/6275b07ad4ed95a17708d8091ea227f3ab6c9aa5>

[20] [CITE[IRC logs: freenode / #whatwg / 20150917]]
([TIME[2015-09-18 17:27:21 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20150917>

[21] [CITE@en[Move structured cloning out from under Common DOM Interfaces · whatwg/html@e09b782]]
([TIME[2016-03-01 11:48:32 +09:00]] 版)
<https://github.com/whatwg/html/commit/e09b7824480ffc9df69b0d830c4b8adad3b000d1>

[22] [CITE@en[Write structured clone algorithm in terms of ECMAScript · whatwg/html@bfb960c]]
([TIME[2016-03-02 16:37:15 +09:00]] 版)
<https://github.com/whatwg/html/commit/bfb960c938580c95e77365e614218b952f96375b>

[23] [CITE@en[Fix enumerability checking in StructuredClone · whatwg/html@c681eb6]]
([TIME[2016-03-02 16:46:51 +09:00]] 版)
<https://github.com/whatwg/html/commit/c681eb6cc1ca3c61f225aac268c34d7206ec1e7f>

[24] [CITE@en[Only clone own properties of ordinary objects and arrays · whatwg/html@31ef428]]
([TIME[2016-03-02 16:47:39 +09:00]] 版)
<https://github.com/whatwg/html/commit/31ef4285935eb22516fc054c42db6a0dc36d580b>

[25] [CITE@en[Make StructuredClone throw if an object is not explicitly cloneable · whatwg/html@32e3822]]
([TIME[2016-03-04 15:55:35 +09:00]] 版)
<https://github.com/whatwg/html/commit/32e3822b17be39ad2d6dea96f5c5a6b88cd5c47a>

[26] [CITE@en[Fix #101: always strip U+0009, U+000A, and U+000D · whatwg/url@7b40216]]
([TIME[2016-03-08 18:33:25 +09:00]] 版)
<https://github.com/whatwg/url/commit/7b40216f809c7fe3c9a1680b5c1b06a771c9ebd8>

[27] [CITE@en[Collect enumerable keys first when cloning ordinary objects · whatwg/html@679acd0]]
([TIME[2016-03-09 15:31:09 +09:00]] 版)
<https://github.com/whatwg/html/commit/679acd0c723c77ba636b5aa17042ae6204c69cc1>

[28] [CITE@en[28389 – Allow error objects to be structured-clonable]]
([TIME[2016-03-17 16:49:01 +09:00]] 版)
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=28389>

[29] [CITE@en[26383 – Structure clones: Should cloned key/values be mutable after cloning?]]
([TIME[2016-03-17 17:01:12 +09:00]] 版)
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=26383>

[30] [CITE@en[Add a section on performing structured clones from other specifications]]
([[domenic]]著, [TIME[2016-06-30 02:46:49 +09:00]])
<https://github.com/whatwg/html/commit/21d5b5ce69f3e5e0f0641659d426d7b005eefc66>

[31] [CITE@en[Editorial: remove structured cloning section]]
([[annevk]]著, [TIME[2016-08-10 22:50:02 +09:00]])
<https://github.com/whatwg/fetch/commit/3dc1612fce7ab38673854d0bf26a4e118e52f077>

[32] [CITE@en[Clarify why we're not using EnumerableOwnProperties]]
([[domenic]]著, [TIME[2016-11-16 05:25:29 +09:00]])
<https://github.com/whatwg/html/commit/fbe5cfef8c439ed81dc47011db0110a3ba4ab53a>

[33] [CITE@en[Integrate SharedArrayBuffers · Issue #2260 · whatwg/html]]
([TIME[2017-01-12 14:00:11 +09:00]])
<https://github.com/whatwg/html/issues/2260>

[34] [CITE@en[Use StructuredClone() hook (Resolves #135)]]
([[inexorabletash]]著, [TIME[2017-01-19 09:05:18 +09:00]])
<https://github.com/w3c/IndexedDB/commit/4ccf4371e3e1a32a6f3ab1606605e71a8f4f8334>

[35] [CITE@en[API Concerns with Structured Clone for Wasm Modules · Issue #972 · WebAssembly/design]]
([TIME[2017-02-03 23:16:51 +09:00]])
<https://github.com/WebAssembly/design/issues/972>

[36] [CITE@en[Breaking: refactor structured clone into serialize/deserialize]]
([[domenic]]著, [TIME[2017-03-21 06:09:33 +09:00]])
<https://github.com/whatwg/html/commit/97d644c97335956610a31e8ad98d1a388c063e84>

[38] [CITE@en[Structured clone architecture significantly changed]]
([[Domenic Denicola]]著, [TIME[2017-03-21 06:27:04 +09:00]])
<https://lists.w3.org/Archives/Public/public-script-coord/2017JanMar/0025.html>

[39] [CITE@en[Editorial: URL parsing relies on Blob URL Store lookup]]
([[annevk]]著, [TIME[2017-03-22 22:44:15 +09:00]])
<https://github.com/whatwg/html/commit/a0a23b96872a81e224c80881e71d58d8326e472e>

[40] [CITE@en[Remove StructuredClone call]]
([[annevk]]著, [TIME[2017-03-23 16:48:41 +09:00]])
<https://github.com/whatwg/url/commit/9f1c19dfc90f99b7d4f214ae0234df89689b306e>

[41] [CITE@en[Use HTML's concepts of serializing and deserializing objects]]
([[annevk]]著, [TIME[2017-03-22 02:02:05 +09:00]])
<https://github.com/whatwg/notifications/commit/8eaabd2b6148696342ecb9427d0d882ed23884bb>

[42] [CITE@en[Update for changes to HTML's structured cloning/transferring]]
([[domenic]]著, [TIME[2017-04-05 14:55:44 +09:00]])
<https://github.com/whatwg/streams/commit/480b2a364e7f2d2532befed032f597719d05cfa5>

[43] [CITE@en[Deserialize typed array objects in targetRealm as well]]
([[annevk]]著, [TIME[2017-04-18 18:54:49 +09:00]])
<https://github.com/whatwg/html/commit/d5f63d26ce4b272257696d0da10788a62ecd16e4>

[44] [CITE@en[Define messageerror]]
([[annevk]]著, [TIME[2017-04-13 20:36:23 +09:00]])
<https://github.com/whatwg/html/commit/25a94f606e983534a863a0559d65bd29bb940a02>

[45] [CITE@en[Define messageerror]]
([[annevk]]著, [TIME[2017-04-13 20:36:23 +09:00]])
<https://github.com/whatwg/html/commit/25a94f606e983534a863a0559d65bd29bb940a02>

[46] [CITE@en[Serializing and deserializing SharedArrayBuffer]]
([[annevk]]著, [TIME[2017-04-28 16:38:26 +09:00]])
<https://github.com/whatwg/html/commit/b3f8779c76de7718bc970fdbccda18a5164d2f98>

[47] [CITE@en[Use StructuredSerializeForStorage]]
([[annevk]]著, [TIME[2017-04-24 18:04:11 +09:00]])
<https://github.com/whatwg/notifications/commit/8323d18ede1f7cfddd34b4260dd8408b16807ddd>

[48] [CITE@en['''['''geometry''']''' Define serialize/deserialize steps]]
([[zcorpan]]著, [TIME[2017-05-15 22:18:42 +09:00]])
<https://github.com/w3c/fxtf-drafts/commit/582844c27b009c1144d5d47676c0dcd54182983b>

[49] [CITE@en[Correct variable names in serialize and deserialize sections]]
([[annevk]]著, [TIME[2017-05-15 22:14:04 +09:00]])
<https://github.com/whatwg/html/commit/48c6b1f5823b2a336fa753f956a28196e0115f03>

[50] [CITE@en['''['''geometry''']''' Do not structured serialize -0 for m13 of a 2d matrix]]
([[zcorpan]]著, [TIME[2017-05-16 18:30:59 +09:00]])
<https://github.com/w3c/fxtf-drafts/commit/bc125ded1bc101144646000a38655053bdc58199>

[51] [CITE@en[Add serialization and deserialization steps to Blob/File/FileList int…]]
([[mkruisselbrink]]著, [TIME[2017-09-26 07:20:26 +09:00]])
<https://github.com/w3c/FileAPI/commit/828c3b6a44195298790b32507c40163703d5ba3e>

[52] [CITE@en[Add serialization and deserialization steps to Blob/File/FileList int…]]
([[mkruisselbrink]]著, [TIME[2017-09-26 07:20:26 +09:00]])
<https://github.com/w3c/FileAPI/commit/828c3b6a44195298790b32507c40163703d5ba3e>

[53] [CITE@en[Define cloning of Blob and FileList objects inline · Issue #32 · w3c/FileAPI]]
([TIME[2017-09-27 10:39:49 +09:00]])
<https://github.com/w3c/FileAPI/issues/32>

[54] [CITE@en[Remove FileAPI monkey-patch]]
([[mkruisselbrink]]著, [TIME[2017-09-26 23:49:10 +09:00]])
<https://github.com/whatwg/html/commit/766dcd3b73b9639aad9bbc8529741f7d516f00d7>

[55] [CITE@en[Remove FileAPI monkey-patch. by mkruisselbrink · Pull Request #3071 · whatwg/html]]
([TIME[2017-09-27 16:12:30 +09:00]])
<https://github.com/whatwg/html/pull/3071>

[56] [CITE@en[Uint8ClampedArray does not have a '''[''''''['''Detached''']'''''']''' internal slot]]
([[annevk]]著, [TIME[2018-01-13 03:52:06 +09:00]])
<https://github.com/whatwg/html/commit/29d83435dac041e56f0f4d7076edfd6f2afadd4b>

[57] [CITE@en[Fix StructuredDeserializeWithTransfer()]]
([[annevk]]著, [TIME[2018-02-06 01:29:24 +09:00]])
<https://github.com/whatwg/html/commit/1fcbe87de45952104b74ac639b9802fa6fd4a338>

[58] [CITE@en[Fix StructuredDeserializeWithTransfer() by annevk · Pull Request #3437 · whatwg/html]]
([TIME[2018-02-06 13:32:49 +09:00]])
<https://github.com/whatwg/html/pull/3437>

[59] [CITE@en[Permit structured serialization of BigInt]]
([[littledan]]著, [TIME[2018-02-26 09:32:16 +09:00]])
<https://github.com/whatwg/html/commit/01bc5df44d6db653451e18f7b9d32827a808db18>

[60] [CITE@en[Normative: Permit serialization of BigInt by littledan · Pull Request #3480 · whatwg/html]]
([TIME[2018-02-27 16:49:35 +09:00]])
<https://github.com/whatwg/html/pull/3480>

[61] [CITE@en[will major browsers support native IndexedDb sorting for BigInt? or will users need to custom-serialize it themselves in sortable form? · Issue #123 · tc39/proposal-bigint]]
([TIME[2018-02-27 16:52:44 +09:00]])
<https://github.com/tc39/proposal-bigint/issues/123>

[62] [CITE@en[Duplicates in StructuredSerializeWithTransfer's transferList]]
([[annevk]]著, [TIME[2018-02-27 00:36:52 +09:00]])
<https://github.com/whatwg/html/commit/869d4512e8eca0b144e8f3b2a61389635a16f662>

[63] [CITE@en[Duplicates in transferList for structured cloning · Issue #3507 · whatwg/html]]
([TIME[2018-02-27 17:08:12 +09:00]])
<https://github.com/whatwg/html/issues/3507>

[64] [CITE@en[No duplicates in StructuredSerializeWithTransfer's transferList by annevk · Pull Request #3508 · whatwg/html]]
([TIME[2018-02-27 17:08:19 +09:00]])
<https://github.com/whatwg/html/pull/3508>

[65] [CITE@en[Check for transferable detachedness after serializing]]
([[annevk]]著, [TIME[2018-03-21 17:48:29 +09:00]])
<https://github.com/whatwg/html/commit/233d984d09f288643cefd704fa70221eacd50a67>

[66] [CITE@en[Check for transferable detachedness after serializing by annevk · Pull Request #3557 · whatwg/html]]
([TIME[2018-03-22 14:11:18 +09:00]])
<https://github.com/whatwg/html/pull/3557>

[67] [CITE@en[Merge pull request #1810 from stefhak/struct_serialize]]
([[aboba]]著, [TIME[2018-06-28 23:40:04 +09:00]])
<https://github.com/w3c/webrtc-pc/commit/7ab932b20c6d533ca057191aa0777ae4a9354bce>

[68] [CITE@en[Update structured cloning for recent changes to HTML by stefhak · Pull Request #1810 · w3c/webrtc-pc]]
([TIME[2018-06-29 23:07:22 +09:00]])
<https://github.com/w3c/webrtc-pc/pull/1810>

[69] [CITE@en[Update for structured cloning changes in HTML · Issue #1089 · w3c/webrtc-pc]]
([TIME[2018-06-29 23:09:17 +09:00]])
<https://github.com/w3c/webrtc-pc/issues/1089>

[70] [CITE@en[Update structured cloning for recent changes to HTML by domenic · Pull Request #1108 · w3c/webrtc-pc]]
([TIME[2018-06-29 23:10:28 +09:00]])
<https://github.com/w3c/webrtc-pc/pull/1108>

[71] [CITE@en[revert PR#1108 by fluffy · Pull Request #1171 · w3c/webrtc-pc]]
([TIME[2018-06-29 23:10:43 +09:00]])
<https://github.com/w3c/webrtc-pc/pull/1171>

[72] [CITE@en[Fix reference to transfer'''['''-receiving''']''' steps]]
([[littledan]]著, [TIME[2018-11-26 18:21:04 +09:00]])
<https://github.com/whatwg/html/commit/0e61f50557e6e97d6f1260836f86b2c87b68af0f>

[73] [CITE@en[Editorial: Fix reference to transfer'''['''-receiving''']''' steps by littledan · Pull Request #4201 · whatwg/html]]
([TIME[2019-05-18 11:48:16 +09:00]])
<https://github.com/whatwg/html/pull/4201>

[74] [CITE@en[Define serialization and deserialization steps for errors]]
([[yutakahirano]], [TIME[2019-07-04 00:03:13 +09:00]], [TIME[2021-04-12T06:50:27.000Z]])
<https://github.com/whatwg/html/commit/af9f08794fc97d442f8a25c5eeac9f9f70aea498>

[75] [CITE@en[Mark DOMException as serializable by yutakahirano · Pull Request #732 · heycam/webidl]]
([TIME[2021-04-12T06:51:40.000Z]])
<https://github.com/heycam/webidl/pull/732>

[76] [CITE@en[Allow structured cloning of native error types · Issue #4268 · whatwg/html]]
([TIME[2021-04-12T06:51:57.000Z]])
<https://github.com/whatwg/html/issues/4268>

[77] [CITE@en[Structured cloning of errors · Issue #165 · mozilla/standards-positions]]
([TIME[2021-04-12T06:58:15.000Z]])
<https://github.com/mozilla/standards-positions/issues/165>

[78] [CITE@en[28389 – Allow error objects to be structured-clonable]]
([TIME[2019-04-02T04:48:11.000Z]], [TIME[2021-04-12T06:59:15.484Z]])
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=28389>

[79] [CITE@en[Define serialization and deserialization steps for Error by yutakahirano · Pull Request #4665 · whatwg/html]]
([TIME[2021-04-12T07:02:38.000Z]])
<https://github.com/whatwg/html/pull/4665>

[80] [CITE@en[Make DOMException serializable]]
([[yutakahirano]], [TIME[2019-07-04 00:04:17 +09:00]], [TIME[2021-04-12T07:08:57.000Z]])
<https://github.com/heycam/webidl/commit/f23ef42038a1d6af6ba19806c8246673711ee7ca>

[81] [CITE@en[Define serialization and deserialization steps for DOMException · Issue #729 · heycam/webidl]]
([TIME[2021-04-12T07:10:33.000Z]])
<https://github.com/heycam/webidl/issues/729>

[82] [CITE@en[Mark DOMException as serializable by yutakahirano · Pull Request #732 · heycam/webidl]]
([TIME[2021-04-12T07:12:05.000Z]])
<https://github.com/heycam/webidl/pull/732>