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