Javascript cloneNode(deep) should clone all attributes (as I understand it). A clone of an <INPUT> element does not contain the VALUE attribute. Mozilla and IE do. This has never worked in any version of Safari, including latest Webkit build obtained using 'Nightshift'. Use test case included, fill the input field with a value, and clone it. <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML XMLNS="http://www.w3.org/1999/xhtml"> <HEAD> <TITLE>cloneNode(deep) Test Case</TITLE> <SCRIPT TYPE="text/javascript" LANGUAGE="javascript"> function deepCloneTest() { //Get the input field and clone it. //Append the cloned element to the document. //When a 'deep' clone is created, should the current value of the source field not be cloned? //Mozilla and (ugh) IE do it. var sourceElement = document.getElementById("TestElement"); var newElement = sourceElement.cloneNode(true); newElement.id = "ClonedElement"; sourceElement.parentNode.appendChild(newElement); } </SCRIPT> </HEAD> <BODY> <INPUT ID="TestElement" TYPE="text" SIZE="20" MAXLENGTH="20" /> <INPUT TYPE="button" VALUE="Clone Input Field" ONCLICK="deepCloneTest()"/> </BODY> </HTML>
Created attachment 5381 [details] test case, text/html
Created attachment 5382 [details] test case, application/xhtml+xml
Created attachment 5383 [details] fixed test case, application/xhtml+xml
Created attachment 5412 [details] Fix
Comment on attachment 5412 [details] Fix Looks fine to me. r=me
Mass moving XML DOM bugs to the "DOM" Component.