content/base/test/test_base.xhtml

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:48e221a3f8a9
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <title>Test for base URIs</title>
4 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
6 <base href="/tests/content/base/" />
7 <style>
8 #bound { -moz-binding: url("test/file_base_xbl.xml#test"); }
9 </style>
10 </head>
11 <body>
12 <div id="1" xml:base="supercalifragilisticexpialidocious"><p><p xml:base="hello/"><p xml:base="world"><span xml:base="#iamtheverymodelofamodernmajorgeneral">text</span></p></p></p></div>
13 <div id="bound"/>
14 <pre id="test">
15 <script type="application/javascript">
16 SimpleTest.waitForExplicitFinish();
17 addLoadEvent(function() {
18 is(document.baseURI, "http://mochi.test:8888/tests/content/base/",
19 "document base");
20 is(document.body.baseURI, "http://mochi.test:8888/tests/content/base/",
21 "body base");
22
23 var expected =
24 ["http://mochi.test:8888/tests/content/base/supercalifragilisticexpialidocious",
25 "http://mochi.test:8888/tests/content/base/supercalifragilisticexpialidocious",
26 "http://mochi.test:8888/tests/content/base/hello/",
27 "http://mochi.test:8888/tests/content/base/hello/world",
28 "http://mochi.test:8888/tests/content/base/hello/world#iamtheverymodelofamodernmajorgeneral",
29 "http://mochi.test:8888/tests/content/base/hello/world#iamtheverymodelofamodernmajorgeneral",
30 ];
31 var node = document.getElementById("1");
32 while(node) {
33 is(node.baseURI, expected.shift(), "node base");
34 node = node.firstChild;
35 }
36 is(expected.length, 0, "found all expected nodes");
37
38 var svgExpected =
39 ["http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml",
40 "http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml",
41 "http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml#shesellsseashellsbytheseashore",
42 ];
43 node = SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById("bound"))[0];
44 while(node) {
45 is(node.baseURI, svgExpected.shift(), "node base");
46 node = node.firstChild;
47 }
48 is(svgExpected.length, 0, "found all expected nodes");
49
50 SimpleTest.finish();
51 });
52 </script>
53 </pre>
54 </body>
55 </html>

mercurial