The way the clone() method worked, by calling Object.constructor(), is causing TypeErrors in recent browsers. As the documentation for the clone() method stated that the input is treated as JSON we can use the JSON.parse(JSON.stringify()) combo to create a deep clone of the document.
The way the clone() method worked, by calling Object.constructor(), is causing TypeErrors in recent browsers. As the documentation for the clone() method stated that the input is treated as JSON we can use the JSON.parse(JSON.stringify()) combo to create a deep clone of the document.