content/html/document/test/test_bug324378.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial