content/html/document/test/test_bug324378.html

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:2fac0ffeb49f
1 <!DOCTYPE HTML>
2 <html id="a" id="b">
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=324378
5 -->
6 <head id="c" id="d">
7 <head id="j" foo="k" foo="l">
8 <title>Test for Bug 324378</title>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body id="e" id="f">
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=324378">Mozilla Bug 324378</a>
14 <script>
15 var html = document.documentElement;
16 is(document.getElementsByTagName("html").length, 1,
17 "Unexpected number of htmls");
18 is(document.getElementsByTagName("html")[0], html,
19 "Unexpected <html> element");
20 is(document.getElementsByTagName("head").length, 1,
21 "Unexpected number of heads");
22 is(html.getElementsByTagName("head").length, 1,
23 "Unexpected number of heads in <html>");
24 is(document.getElementsByTagName("body").length, 1,
25 "Unexpected number of bodies");
26 is(html.getElementsByTagName("body").length, 1,
27 "Unexpected number of bodies in <html>");
28 var head = document.getElementsByTagName("head")[0];
29 var body = document.getElementsByTagName("body")[0];
30 </script>
31 <p id="display"></p>
32 <div id="content" style="display: none">
33 <html id="g" foo="h" foo="i">
34 <body id="m" foo="n" foo="o">
35 </div>
36 <pre id="test">
37 <script class="testbody" type="text/javascript">
38
39 /** Test for Bug 324378 **/
40 is(document.getElementsByTagName("html").length, 1,
41 "Unexpected number of htmls after additions");
42 is(document.getElementsByTagName("html")[0], html,
43 "Unexpected <html> element");
44 is(document.documentElement, html,
45 "Unexpected root node");
46 is(document.getElementsByTagName("head").length, 1,
47 "Unexpected number of heads after additions");
48 is(document.getElementsByTagName("head")[0], head,
49 "Unexpected <head> element");
50 is(document.getElementsByTagName("body").length, 1,
51 "Unexpected number of bodies after additions");
52 is(document.getElementsByTagName("body")[0], body,
53 "Unexpected <body> element");
54
55 is(html.id, "a", "Unexpected <html> id");
56 is(head.id, "c", "Unexpected <head> id");
57 is(body.id, "e", "Unexpected <body> id");
58 is($("a"), html, "Unexpected node with id=a");
59 is($("b"), null, "Unexpected node with id=b");
60 is($("c"), head, "Unexpected node with id=c");
61 is($("d"), null, "Unexpected node with id=d");
62 is($("e"), body, "Unexpected node with id=e");
63 is($("f"), null, "Unexpected node with id=f");
64 is($("g"), null, "Unexpected node with id=g");
65 is($("j"), null, "Unexpected node with id=j");
66 is($("m"), null, "Unexpected node with id=m");
67
68 is(html.getAttribute("foo"), "h", "Unexpected 'foo' value on <html>");
69 is(head.getAttribute("foo"), null, "Unexpected 'foo' value on <head>");
70 is(body.getAttribute("foo"), "n", "Unexpected 'foo' value on <body>");
71
72 </script>
73 </pre>
74 </body>
75 </html>
76

mercurial