Make sure the deep argument is specified for cloneNode() and importNode()

Published: | Categories: DOM


The Node.cloneNode and document.importNode methods take the boolean deep argument. It’s 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. Though the argument is still optional, Firefox now warns developers in console not to omit the argument for the backward and forward compatibility.