|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 |
|
4 <head> |
|
5 <title>Test for titles</title> |
|
6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
8 <style type="text/css"> |
|
9 </style> |
|
10 </head> |
|
11 |
|
12 <body onload="runTests()"> |
|
13 |
|
14 <p id="display"></p> |
|
15 <div style="display:none;"> |
|
16 <iframe id="html1" src="data:text/html,<html><head><title id='t'>Test</title></head></html>"></iframe> |
|
17 <iframe id="html2" src="data:text/html,<html><head><title id='t'>Test</title><title>Foo</title></head></html>"></iframe> |
|
18 <iframe id="html3" src="data:text/html,<html></html>"></iframe> |
|
19 <iframe id="xhtml1" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><body><title id='t'>Test</title></body></html>"></iframe> |
|
20 <iframe id="xhtml2" src="data:text/xml,<title xmlns='http://www.w3.org/1999/xhtml'>Test</title>"></iframe> |
|
21 <iframe id="xhtml3" src="data:text/xml,<title xmlns='http://www.w3.org/1999/xhtml'>Te<div>bogus</div>st</title>"></iframe> |
|
22 <iframe id="xhtml4" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'/>"></iframe> |
|
23 <iframe id="xhtml5" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><head/></html>"></iframe> |
|
24 <iframe id="xhtml6" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><head><style/></head></html>"></iframe> |
|
25 <iframe id="xul1" src="data:application/vnd.mozilla.xul+xml,<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' title='Test'/>"></iframe> |
|
26 <iframe id="xul2" src="data:application/vnd.mozilla.xul+xml,<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' title='Test'/>"></iframe> |
|
27 <iframe id="svg1" src="data:text/xml,<svg xmlns='http://www.w3.org/2000/svg'><title id='t'>Test</title></svg>"></iframe> |
|
28 <iframe id="svg2" src="data:text/xml,<svg xmlns='http://www.w3.org/2000/svg'><title id='t'>Test</title></svg>"></iframe> |
|
29 </div> |
|
30 |
|
31 <pre id="test"> |
|
32 <script> |
|
33 SimpleTest.waitForExplicitFinish(); |
|
34 |
|
35 function runTests() { |
|
36 function testStatic(id, expect, description) { |
|
37 is(document.getElementById(id).contentDocument.title, expect, description); |
|
38 } |
|
39 |
|
40 testStatic("html1", "Test", "HTML <title>"); |
|
41 testStatic("html2", "Test", "choose the first HTML <title>"); |
|
42 testStatic("html3", "", "No title"); |
|
43 testStatic("xhtml1", "Test", "XHTML <title> in body"); |
|
44 testStatic("xhtml2", "Test", "XHTML <title> as root element"); |
|
45 testStatic("xhtml3", "Test", "XHTML <title> containing an element"); |
|
46 testStatic("xul1", "Test", "XUL <window> title attribute"); |
|
47 testStatic("svg1", "Test", "SVG <title>"); |
|
48 |
|
49 SimpleTest.finish(); |
|
50 } |
|
51 </script> |
|
52 </pre> |
|
53 </body> |
|
54 </html> |