cloneNode and importNode has defaulted to shallow clones

Published: | Categories: DOM | Creative Commons BY-SA 3.0


The Node.cloneNode and document.importNode methods take the boolean deep argument. It was optional in the DOM4 specification, and if omitted, these methods acted as if the value of deep was true. But this behaviour has been changed in the latest spec, and if omitted, the methods will act as if the value was false. The implementation has been changed in Firefox 29, and a shallow clone is now default instead of a deep clone. Firefox 28 warned developers in console not to omit the argument both for the backward and forward compatibility.