|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=42976 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 42976</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 <body onload="runTest()"> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=42976">Mozilla Bug 42976</a> |
|
13 <p id="display"></p> |
|
14 <div id="content"> |
|
15 <iframe id=specialtest src="data:text/html,<meta http-equiv='Content-Language' content='ja-JP'><base href='http://www.mozilla.org'><p>asdf"></iframe>; |
|
16 <iframe id=htmlquirks src="data:text/html;charset=ISO-8859-2,<html><body><div></div></body></html>"></iframe> |
|
17 <iframe id=htmlstd src="data:text/html;charset=ISO-8859-3,<!DOCTYPE html><html><body><div></div></body></html>"></iframe> |
|
18 <iframe id=textplain src="data:text/plain;charset=ISO-8859-4,asdf%0Azxcv%0A"></iframe> |
|
19 <iframe id=xhtmlstd src="data:application/xhtml+xml;charset=ISO-8859-5,<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'><body><div></div></body></html>"></iframe> |
|
20 <iframe id=xmlstd src="data:image/svg+xml;charset=ISO-8859-6,<svg xmlns="http://www.w3.org/2000/svg" width='300' height='300'><text x='60' y='150' fill='blue'>Hello, World!</text><text x='60' y='250' fill='blue'>Hello, World!</text></svg>"></iframe> |
|
21 </div> |
|
22 <pre id="test"> |
|
23 <script class="testbody" type="text/javascript"> |
|
24 |
|
25 SimpleTest.waitForExplicitFinish(); |
|
26 |
|
27 function runTest() { |
|
28 |
|
29 var iframes = document.getElementsByTagName("iframe"); |
|
30 for (var i = 1; i < iframes.length; i++) { |
|
31 var doc = iframes[i].contentDocument; |
|
32 var clonefalse = doc.cloneNode(false); |
|
33 // doc.compatMode |
|
34 ok(doc.compatMode == clonefalse.compatMode, "compatMode not preserved correctly; " + iframes[i].id); |
|
35 |
|
36 // doc.contentType |
|
37 ok(doc.contentType == clonefalse.contentType, "contentType not preserved correctly; " + iframes[i].id); |
|
38 |
|
39 // doc.characterSet |
|
40 ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id); |
|
41 |
|
42 // innerHTML+tag case test |
|
43 var clonetrue = doc.cloneNode(true); |
|
44 doc.documentElement.firstChild.innerHTML="<div><dD></dD></div>"; |
|
45 clonetrue.documentElement.firstChild.innerHTML="<div><dD></dD></div>"; |
|
46 ok(doc.documentElement.innerHTML == clonetrue.documentElement.innerHTML, |
|
47 "innerHTML not preserved correctly; " + iframes[i].id); |
|
48 |
|
49 } |
|
50 |
|
51 // A couple of tests that don't quite fit in the framework. |
|
52 var doc = iframes[0].contentDocument; |
|
53 |
|
54 // Setting document.dir does nothing in a document without an <html> element |
|
55 doc.dir="rtl"; |
|
56 var docclone = doc.cloneNode(false); |
|
57 |
|
58 // doc.dir |
|
59 ok(docclone.dir == "", "dir set on doc without html element"); |
|
60 |
|
61 // document.querySelectorAll(":lang(ja)") |
|
62 docclone.appendChild(docclone.createElement("html")); |
|
63 ok(docclone.querySelectorAll(":lang(ja)").length == 1, "lang not preserved correctly"); |
|
64 |
|
65 docclone.documentElement.innerHTML="<body><p><a href='a.html' id=a>asf</a></body>"; |
|
66 ok(docclone.getElementById('a').href == "http://www.mozilla.org/a.html", |
|
67 "base not preserved correctly"); |
|
68 |
|
69 // Now that we have an <html> element, deep cloning preserves document.dir |
|
70 docclone.dir="rtl"; |
|
71 var cloneclone = docclone.cloneNode(true); |
|
72 |
|
73 // doc.dir |
|
74 ok(cloneclone.dir == "rtl", "dir not preserved correctly"); |
|
75 |
|
76 SimpleTest.finish(); |
|
77 } |
|
78 </script> |
|
79 </pre> |
|
80 </body> |
|
81 </html> |