Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / serialize-nodes.xhtml
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:foo="http://foo.com" xmlns:bar="http://bar.com" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5 <title>XMLSerializer() namespace test</title>
6 <script>
7 window.addEventListener("load", function() {
8     if (window.testRunner)
9         testRunner.dumpAsText();
10     
11     var xs = new XMLSerializer();
12     var content = document.getElementById('content');
13     content.firstChild.nodeValue = xs.serializeToString(document.getElementById('input'));
14
15     // Original test
16     var d = document.implementation.createDocument("urn:foo-ns", "foo:root", null);
17     if (!d.documentElement) {
18         // This shouldn't happen, since DomImplementation.createDocument
19         // is supposed to create the root element.  But in Safari, it's required.
20         d.appendChild(d.createElementNS("urn:foo-ns", "foo:root"));
21     }
22     var root = d.documentElement;
23     root.setAttributeNS("urn:foo-ns", "foo:type", "test")
24     
25     var c = d.createElementNS(null, "child");
26     root.appendChild(c);
27     
28     c.setAttributeNS("urn:foo-ns", "foo:name", "one");
29     c.setAttributeNS("urn:bar-ns", "bar:name", "two");
30     var attr = d.createAttribute("name");
31     var text = d.createTextNode("three");
32     attr.appendChild(text);
33     c.setAttributeNode(attr);
34     
35     window.alert("foo:name is " + c.getAttributeNS("urn:foo-ns", "name") + " and should be one");
36     window.alert("bar:name is " + c.getAttributeNS("urn:bar-ns", "name") + " and should be two");
37     window.alert("name is " + c.getAttributeNS(null, "name") + " and should be three");
38     window.alert("node is " + d.getElementsByTagNameNS(null, "child").item(0).nodeName + " and should be child");
39     window.alert(xs.serializeToString(d));
40 }, false);
41 </script>
42 </head>
43 <body>
44 <pre id="content">foo</pre>
45 <div id="input">
46     <div>
47         <foo:node xmlns="http://baz.com" foo:name="foo_name" bar:name="bar_name">
48             <node foo:name="foo_name">
49                 <bar:node xmlns:bar="http://bar2.com"/>
50             </node>
51         </foo:node>
52     </div>
53     <bar:node>
54         <br />
55     </bar:node>
56 </div>
57 </body>
58 </html>