Bug 991: Tell users not to quote % in MIME handlers.
[elinks.git] / test / ecmascript / accesskey.html
blob65d626181f7bf6f031d8b053fca4fed13d739f3a
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
2 "http://www.w3.org/TR/REC-html40/strict.dtd">
3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4 <meta http-equiv="Content-Script-Type" content="application/ecmascript">
5 <title>ECMAScript accessKey tests</title>
6 <h1>ECMAScript accessKey tests</h1>
8 <h2>Set valid access keys and read them back</h2>
10 <p>This does not automatically test that the assigned access keys
11 actually work.</p>
12 <form name="form1" action="#">
13 <p><input type="button" onclick="run1()" value="Test"> <input id="result1" value="not run">
14 <input type="reset">
15 <table>
16 <tr><td><input id="a1" accesskey="a"><td><td>empty string
17 <tr><td><input id="b1" accesskey="b"><td>U+0020<td>must not become "Space"
18 <tr><td><input id="c1" accesskey="c"><td>U+0025<td>ASCII punctuation
19 <tr><td><input id="d1" accesskey="d"><td>U+007A<td>ASCII letter
20 <tr><td><input id="e1" accesskey="e"><td>U+00E5<td>Latin-1
21 <tr><td><input id="f1" accesskey="f"><td>U+0161<td>Latin-9
22 <tr><td><input id="g1" accesskey="g"><td>U+3042<td>Hiragana
23 <tr><td><input id="h1" accesskey="h"><td>U+10A55<td>Kharoshthi
24 </table>
25 </form>
26 <script type="application/ecmascript">
27 function run1() {
28 var form = window.document.forms["form1"];
29 form.elements["result1"].value = "running";
30 var ok = true;
31 var probe = function(element, accessKey) {
32 element.accessKey = accessKey;
33 if (element.accessKey != accessKey) {
34 ok = false;
35 element.value = "failed " + accessKey + "/" + element.accessKey;
36 } else {
37 element.value = "passed " + accessKey + "/" + element.accessKey;
40 probe(form.elements["a1"], "");
41 probe(form.elements["b1"], " ");
42 probe(form.elements["c1"], "%");
43 probe(form.elements["d1"], "z");
44 probe(form.elements["e1"], "\u00E5");
45 probe(form.elements["f1"], "\u0161");
46 probe(form.elements["g1"], "\u3042");
47 probe(form.elements["h1"], "\uD802\uDE55");
48 form.elements["result1"].value = ok ? "passed" : "failed";
49 return false;
51 </script>
53 <h2>These might throw errors</h2>
54 <form name="form2" action="#">
55 <table>
56 <tr><td><input type="button" value="Test" onclick='run2("a2",-273.15)'><td><input id="a2"><td>number -273.15
57 <tr><td><input type="button" value="Test" onclick='run2("b2","\u0000")'><td><input id="b2"><td>U+0000
58 <tr><td><input type="button" value="Test" onclick='run2("c2","\u0001")'><td><input id="c2"><td>U+0001
59 <tr><td><input type="button" value="Test" onclick='run2("d2","\u000A")'><td><input id="d2"><td>U+000A
60 <tr><td><input type="button" value="Test" onclick='run2("e2","hyi")'><td><input id="e2"><td>"hyi"
61 <tr><td><input type="reset">
62 </table>
63 </form>
64 <script type="application/ecmascript">
65 function run2(name, accessKey) {
66 var form = window.document.forms["form2"];
67 var element = form.elements[name];
68 element.accessKey = accessKey;
69 if (element.accessKey != accessKey)
70 element.value = "different " + accessKey + "/" + element.accessKey;
71 else
72 element.value = "same " + accessKey + "/" + element.accessKey;
73 return false;
75 </script>
77 <h2>Invalid uses of surrogates</h2>
78 <form name="form3" action="#">
79 <table>
80 <tr><td><input type="button" value="Test" onclick='run3("a3","\uD800")'><td><input id="a3"><td>U+D800
81 <tr><td><input type="button" value="Test" onclick='run3("b3","\uD800.")'><td><input id="b3"><td>U+D800 U+002E
82 <tr><td><input type="button" value="Test" onclick='run3("c3","\uD800\uD800")'><td><input id="c3"><td>U+D800 U+D800
83 <tr><td><input type="button" value="Test" onclick='run3("d3","\uD800\uDBFF")'><td><input id="d3"><td>U+D800 U+DBFF
84 <tr><td><input type="button" value="Test" onclick='run3("e3","\uD800\uE000")'><td><input id="e3"><td>U+D800 U+E000
85 <tr><td><input type="button" value="Test" onclick='run3("f3","\uDBFF\uDBFF")'><td><input id="f3"><td>U+DBFF U+DBFF
86 <tr><td><input type="button" value="Test" onclick='run3("g3","\uDC00")'><td><input id="g3"><td>U+DC00
87 <tr><td><input type="button" value="Test" onclick='run3("h3","\uDC00.")'><td><input id="h3"><td>U+DC00 U+002E
88 <tr><td><input type="button" value="Test" onclick='run3("i3","\uDC00\uD800")'><td><input id="i3"><td>U+DC00 U+D800
89 <tr><td><input type="button" value="Test" onclick='run3("j3","\uDC00\uDBFF")'><td><input id="j3"><td>U+DC00 U+DBFF
90 <tr><td><input type="button" value="Test" onclick='run3("k3","\uDC00\uDC00")'><td><input id="k3"><td>U+DC00 U+DC00
91 <tr><td><input type="button" value="Test" onclick='run3("l3","\uDC00\uDFFF")'><td><input id="l3"><td>U+DC00 U+DFFF
92 <tr><td><input type="button" value="Test" onclick='run3("m3","\uDC00\uFF20")'><td><input id="m3"><td>U+DC00 U+FF20
93 <tr><td><input type="button" value="Test" onclick='run3("n3","\uDFFF")'><td><input id="n3"><td>U+DFFF
94 <tr><td><input type="button" value="Test" onclick='run3("o3","\uDFFF\uDFFF")'><td><input id="o3"><td>U+DFFF U+DFFF
95 <tr><td><input type="reset">
96 </table>
97 </form>
98 <script type="application/ecmascript">
99 function run3(name, accessKey) {
100 var form = window.document.forms["form3"];
101 var element = form.elements[name];
102 element.accessKey = accessKey;
103 if (element.accessKey != accessKey)
104 element.value = "different " + accessKey + "/" + element.accessKey;
105 else
106 element.value = "same " + accessKey + "/" + element.accessKey;
107 return false;
109 </script>