OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <meta charset="UTF-8"> | |
5 <script> | |
6 | |
7 if (window.testRunner) | |
8 testRunner.dumpAsText(); | |
9 | |
10 function shouldBeTrue(condition, testName) | |
11 { | |
12 var result = testName + ": "; | |
13 if (condition) | |
14 result += "PASS"; | |
15 else | |
16 result += "FAIL"; | |
17 | |
18 document.getElementById("results").innerHTML += result + "<br>"; | |
19 } | |
20 | |
21 function test() | |
22 { | |
23 // With these encodings, backslashes will be transcoded into yen signs. | |
24 var encodings = ["EUC-JP", "Shift_JIS", "ISO-2022-JP"]; | |
25 for (var i = 0; i < encodings.length; i++) { | |
26 var encoding = encodings[i]; | |
27 var frameDocument = frames[i].document; | |
28 shouldBeTrue(frameDocument.execCommand("FindString", false, "¥-in-body")
, "We can find a backslash in " + encoding + " page by finding a yen sign"); | |
29 shouldBeTrue(frameDocument.execCommand("FindString", false, "¥-in-input"
), "We can find a backslash in " + encoding + " text control by finding a yen si
gn"); | |
30 } | |
31 | |
32 shouldBeTrue(!document.execCommand("FindString", false, "¥-in-body"), "We ca
n NOT find a backslash in UTF8 page by finding a yen sign"); | |
33 shouldBeTrue(!document.execCommand("FindString", false, "¥-in-input"), "We c
an NOT find a backslash in UTF8 text control by finding a yen sign"); | |
34 } | |
35 | |
36 </script> | |
37 </head> | |
38 <body onload="test()"> | |
39 | |
40 <div>\-in-body</div> | |
41 <input value=\-in-input> | |
42 <iframe src="data:text/html;charset=EUC-JP,<body>\-in-body<input value=\-in-inpu
t></body>"></iframe> | |
43 <iframe src="data:text/html;charset=Shift_JIS,<body>\-in-body<input value=\-in-i
nput></body>"></iframe> | |
44 <iframe src="data:text/html;charset=ISO-2022-JP,<body>\-in-body<input value=\-in
-input></body>"></iframe> | |
45 | |
46 <p>Results</p> | |
47 | |
48 <p id="results"> | |
49 </p> | |
50 </body> | |
51 </html> | |
OLD | NEW |