test_base.xhtml (1320B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>Test for base URIs</title> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 6 <base href="/tests/dom/base/" /> 7 </head> 8 <body> 9 <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> 10 <pre id="test"> 11 <script type="application/javascript"> 12 SimpleTest.waitForExplicitFinish(); 13 addLoadEvent(function() { 14 is(document.baseURI, "http://mochi.test:8888/tests/dom/base/", 15 "document base"); 16 is(document.body.baseURI, "http://mochi.test:8888/tests/dom/base/", 17 "body base"); 18 19 var expected = 20 ["http://mochi.test:8888/tests/dom/base/", 21 "http://mochi.test:8888/tests/dom/base/", 22 "http://mochi.test:8888/tests/dom/base/", 23 "http://mochi.test:8888/tests/dom/base/", 24 "http://mochi.test:8888/tests/dom/base/", 25 "http://mochi.test:8888/tests/dom/base/", 26 ]; 27 var node = document.getElementById("1"); 28 while(node) { 29 is(node.baseURI, expected.shift(), "node base"); 30 node = node.firstChild; 31 } 32 is(expected.length, 0, "found all expected nodes"); 33 34 SimpleTest.finish(); 35 }); 36 </script> 37 </pre> 38 </body> 39 </html>