Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / cloneNode.html
bloba94433d48cc1e5963306dd408c40a4f65642a0ad
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script>
5 function log(s)
7 var logDiv = document.getElementById("log");
8 logDiv.appendChild(document.createTextNode(s));
9 logDiv.appendChild(document.createElement('br'));
12 function matches(node, clonedNode, passedMessage)
14 if (node.localName === clonedNode.localName && node.prefix === clonedNode.prefix && node.namespaceURI === clonedNode.namespaceURI && node.nodeName === clonedNode.nodeName)
15 log("PASSED: " + passedMessage);
16 else
17 log("FAILED");
20 function test()
22 if (window.testRunner)
23 testRunner.dumpAsText();
25 var xmlDoc = document.implementation.createDocument("http://www.example.com", "foo:bar", null);
27 var xmlNode = xmlDoc.createElement("foo:bar");
28 var clonedXMLNode = xmlNode.cloneNode(false); // WebKit crashes.
29 var htmlNode = document.getElementById('log');
30 var clonedHTMLNode = htmlNode.cloneNode(false);
32 matches(xmlNode, clonedXMLNode, "Cloned XML node matches the original");
33 matches(htmlNode, clonedHTMLNode, "Cloned HTML node matches the original");
35 </script>
36 </head>
37 <body onload="test()">
38 <p> Test for bug Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=23956">23956</a>: Safari crashes when cloneNode fails (cloning a XML element with an invalid nodeName)</p>
39 <p> For this test to pass, it should not crash and you should see PASSED twice.</p>
40 <div id='log'/>
41 </body>
42 </html>