今日推荐英文原文：《Is Deep Cloning Coming to Our Browsers?》
推荐理由：现在 UI 设计变得越来越友好，windows 98 风格的 UI 界面已经逐渐销声匿迹，不过有的时候为了特地表现出古老，没准还需要把它拿出来。这个项目是一个纯 CSS 库，里面充满了上古版本的 UI 界面，打开官网就会发现古老的气息扑面而来。
今日推荐英文原文：《Is Deep Cloning Coming to Our Browsers?》作者：Johannes Baum
Is Deep Cloning Coming to Our Browsers?
Structured CloningThe structured clone algorithm was proposed by the HTML standard, already has an implementation in common browsers, and is used internally (i.e., for transferring data between web workers or for storing data with IndexedDB).
It recursively walks through the object to be cloned and maintains a map of visited references in order to avoid infinite cycles. Therefore circular structures are not a problem for this algorithm, compared to the JSON.parse(JSON.stringify(…)) approach, for example.
The structured clone algorithm, on the other hand, is a well-defined algorithm and therefore defines pretty well what a structured clone is. One could say it is a specific implementation of a deep clone.
Structured Cloning in Browsers?While Node.js exposed the implementation of structured cloning by the v8 JS engine as their Serialization API, many people are still waiting for an exposed implementation of a browser. If you are one of these people, there is good news: A proposal in the HTML specification already exists.
Unfortunately, it seems that at the time writing, only Firefox is interested in implementing it. However, the topic is still discussed, so don’t give up hope if you are craving that feature.
Even if it is only at the stage of a proposal, it looks like the exposure will come in the form of a global function structuredClone() that will make structural clones as easy as:
const myClone = structuredClone(originalObject);