aboutsummaryrefslogtreecommitdiffstats
path: root/offline-submit/jquery.malsup.com.htm
blob: b0008d738b339146cc2dc0e40ad118a604d823e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
<!DOCTYPE html>
<html lang="en">
<head>
<title>JavaScript Form Serialization Comparison</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../jq.css" />
<style type="text/css">
h1, #intro, #testForm td.hint { font-family: 'trebuchet ms', verdana, arial; }
h1 { padding-left: 0 }
#intro { background: #ffc; padding: 10px }
#banner { text-align: left; }
code.inline { background-color: #dfe0ff; color: #000 } 
ul { padding-left: 20px; margin: 10px 10px 10px 0 }
#disclaimer { font-family: arial, sans-serif; font-size: small; font-style: italic; color: #555; margin-bottom: 5px}
span.name { color: #c22 }
span.dis { color: #f11 }
#results { margin: 15px 0 }
#results div { font-family: monospace; color: #888; }
#results td { padding: 5px; }
#testForm { border: 1px solid #888; background-color: #eee; padding: 0px }
#testForm tr { background-color: #eee; }
#testForm td { font-family: monospaced; padding: 2px 10px; }
#testForm td.hint { color: #880; background: #ffc url(infoIcon.png) 5px 50%  no-repeat; padding: 5px 5px 5px 30px }
#toolbar { padding: 5px; border: 1px solid #aaa; border-width: 1px 0; background-color: #eee }
#main { padding-top: 0; }
legend, .wrong, span.dis { font-weight: bold }
.wrong { color: #f00; }
ul li { list-style-type: square }
ol li { list-style-type: decimal  }
blockquote { padding: 10px; border: 1px dashed #aaa; line-height: 1.5em; font-family: sans-serif; background-color: #ffe }
#footer { margin-top: 15px; padding-top: 10px; border-top: 1px solid #ddd; color: #888; }
#main { padding: 15px }
</style>
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../jquery.form.js"></script>
<script type="text/javascript" src="mochi.base.js"></script>
<script type="text/javascript" src="mochi.iter.js"></script>
<script type="text/javascript" src="mochi.dom.js"></script>

<script type="text/javascript" src="dojo.js"></script>
<script type="text/javascript" src="dojo.xhr.js"></script>

<script type="text/javascript" src="prototype-1.6.0.3.js"></script>
<!--<script type="text/javascript" src="mootools-1.2.1.js"></script>-->
<script type="text/javascript" src="yahoo.js"></script>
<script type="text/javascript" src="yui-event.js"></script>
<script type="text/javascript" src="yui-connection.js"></script>

<script type="text/javascript" src="firebug.js"></script>
<script type="text/javascript" src="../../chili-1.7.pack.js"></script>
<script type="text/javascript"><!--



//

// note that all usage of $ in this file is using Prototype's $ fn

//

var q, iter;



// initialize test harness

jQuery(init);



function init() {

    // profiling in FF only

    if (!/Firefox/.test(navigator.userAgent)) {

        $('timer').checked = true;

        $('profiler').disabled = true;

        console.open();

    }



    // bind the Test buttons to the 'runTest' function

    jQuery('input.tester').click(function() { runTest(this); });



    // let's see browser's native form serialization too!

    var match = window.location.href.match(/\?([^#]+)/);

    if (!match) return;

    $('nativeOutput').innerHTML = match[1].escapeHTML();

}



function runTest(e) {

    $('S5').selectedIndex = -1; // for the S5 test - force selectedIndex to -1

    iter = $('iterations').value;

    var name = e.id;

    var n = '('+iter+') ' + name;

    var useTimer = jQuery('#toolbar :radio').fieldValue() == 1;

    

    // start clock

    useTimer ? console.time(n) : console.profile(n);



    try {

        // run the test

        window[name+'Test']();

    } catch(e) {

        q = 'ERROR: ' + e.message;

    }



    // stop clock

    useTimer ? console.timeEnd(n) : console.profileEnd(n);

    

    // highlight inaccurate results:

    //    - there should not be any "NO" values, this includes the reset input, submit inputs and disabled inputs

    //    - S5 should not be submitted (the selected index is -1)

    //    - S3 should not be blank

    //    - the query string should not have a trailing ampersand (dojo)

	//    - the "My Name" input should have been converted to My+Name, not My%20Name 

    q = q.replace(/(reset=NO|S5=|&$|sub(\d)=NO|D(\d)=NO)/g, '<span class="wrong">$1</span>');

    q = q.replace(/S3=&/, '<span class="wrong">S3=</span>&');

	q = q.replace(/My(%20)Name/,'<span class="wrong">$1</span>');

    $(name+'Output').innerHTML = q;

}



function jQueryNativeTest() {

    var form = jQuery('#testForm');

    for (var i=0; i < iter; i++)

        q = form.serialize();

}



function jQueryFormTest() {

    var form = jQuery('#testForm');

    for (var i=0; i < iter; i++)

        q = form.formSerialize();

}



function dojoTest() {

    var form = dojo.byId('testForm');

    for (var i=0; i < iter; i++) 

        q = dojo.formToQuery(form);

}



function PrototypeTest() {

    var form = $('testForm');

    for (var i=0; i < iter; i++) 

        q = Form.serialize(form);

}



/*

function mooTest() {

    var form = $('testForm');

    for (var i=0; i < iter; i++) 

        q = form.toQueryString();

}

*/



function YUITest() {

    var form = $('testForm');

    for (var i=0; i < iter; i++) 

        q = YAHOO.util.Connect.setForm(form);

}



function MochiKitTest() {

    var form = $('testForm');

    for (var i=0; i < iter; i++) 

        q = MochiKit.Base.queryString(form);

}

// -->
</script>

</head>
<body>
<h1 id="banner">JavaScript Form Serialization Comparison:&nbsp;&nbsp;&nbsp;jQuery &bull; dojo &bull; Prototype &bull; YUI &bull; MochiKit</h1>
<div id="intro">
    This page tests two things about JavaScript form serialization: <strong>quality</strong> and <strong>speed</strong>.
    <ul>

        <li>Quality is dertermined by analyzing the serialized output according to the <a href="http://www.w3.org/TR/html401/interact/forms.html">W3C Recommendation</a>.</li>
        <li>Speed is measured using <a href="http://www.getfirebug.com/">Firebug</a> to time (or profile in FireFox) numerous iterations of the serialization process.<sup>[1]</sup></li>
    </ul>
    <div id="disclaimer">If you believe the tests or comments on this page are inaccurate
    or unfair - please let me know.  It is not my intent to misrepresent any of these libraries.  
    Feedback can be sent to: forms at malsup dot com.
    </div>
    <div>&raquo;&raquo; Special thanks to Marius Feraru for adding support for native browser output and the EOL test!</div>
</div>
<div id="toolbar">
    <input type="radio" name="time" value="1" checked="checked" id="timer" />Timer <input type="radio" name="time" value="0" id="profiler" />Profiler
    <span style="margin-left: 15px">Iterations:</span> 
    <select id="iterations" name="iterations" class="tester">
        <option value="1" selected="selected">1</option>
        <option value="25">25</option>
        <option value="50">50</option>

        <option value="100">100</option>
        <option value="200">200</option>
    </select>
    <p />
    <input id="jQueryNative" type="button" class="tester" value="jQuery 1.3.2 core" />
    <input id="jQueryForm" type="button" class="tester" value="jQuery 1.3.2 with Form Plugin" />
    <input id="dojo"   type="button" class="tester" value="dojo 1.2.3" />
    <input id="YUI"  type="button" class="tester" value="YUI 2.6.0" />
    <input id="MochiKit"  type="button" class="tester" value="MochiKit 1.4.2" />
    <input id="Prototype"  type="button" class="tester" value="Prototype 1.6.0.3" />
    <!-- <input id="moo"  type="button" class="tester" value="Test moo" /> -->
</div>
<div id="main">
    <form id="results" action="#">
        <fieldset><legend>Output <span style="color:#666"><em>(errors in red)</em></span></legend>
        <table>
            <tr><td>NATIVE</td><td><div id="nativeOutput" class="output"><a href="#" onclick="$('S5').selectedIndex = -1; $('testForm').submit(); return false">check your browser's *native* form serialization</a></div></td></tr>
            <tr><td>jQuery</td><td><div id="jQueryNativeOutput" class="output"></div></td></tr>
            <tr><td>jQuery Form</td><td><div id="jQueryFormOutput" class="output"></div></td></tr>
            <tr><td>dojo</td><td><div id="dojoOutput" class="output"></div></td></tr>
            <tr><td>YUI</td><td><div id="YUIOutput" class="output"></div></td></tr>
            <tr><td>MochiKit</td><td><div id="MochiKitOutput" class="output"></div></td></tr>
            <tr><td>Prototype</td><td><div id="PrototypeOutput" class="output"></div></td></tr>
            <!--<tr><td>moo</td><td><div id="mooOutput" class="output"></div></td></tr> -->

        </table>
        </fieldset>
    </form>
    
    <p>
    The following form contains each of the possible elements that can be submitted (with the exception of <code class="inline">&lt;input type="file"&gt;</code>). 
    Which elements, and how they should be submitted, is specified here: 
    <a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.13">http://www.w3.org/TR/html401/interact/forms.html#h-17.13</a>
    </p>
    
    <form id="testForm" action="#" method="get"><div>

        <table>
        <tr><td class="hint" colspan="2">Most enabled input elements and textareas are handled correctly by each of the libraries.</td></tr>
        <tr><td><code class="html">&lt;textarea name="T3" rows="2" cols="15"&gt;?<br />Z&lt;/textarea&gt;</code></td><td><textarea name="T3" rows="2" cols="15">?Z</textarea></td></tr>
        <tr><td><code class="html">&lt;input type="hidden" name="H1" value="x" /&gt;</code></td><td><input type="hidden" name="H1" value="x" /></td></tr>
        <tr><td><code class="html">&lt;input type="hidden" name="H2" /&gt;</code></td><td><input type="hidden" name="H2" /></td></tr>

        <tr><td><code class="html">&lt;input type="password" name="PWD" /&gt;</code></td><td><input name="PWD" type="password" value="" /></td></tr>
        <tr><td><code class="html">&lt;input type="text" name="T1" /&gt;</code></td><td><input name="T1" type="text" /></td></tr>
        <tr><td><code class="html">&lt;input type="text" name="T2" value="YES" readonly="readonly" /&gt;</code></td><td><input name="T2" type="text" value="YES" readonly="readonly" /></td></tr>
        <tr><td><code class="html">&lt;input type="checkbox" name="C1" value="1" /&gt;</code></td><td><input type="checkbox" name="C1" value="1" /></td></tr>
        <tr><td><code class="html">&lt;input type="checkbox" name="C2" /&gt;</code></td><td><input type="checkbox" name="C2" /></td></tr>
        <tr><td><code class="html">&lt;input type="radio" name="R1" value="1" /&gt;</code></td><td><input type="radio" name="R1" value="1" /></td></tr>

        <tr><td><code class="html">&lt;input type="radio" name="R1" value="2" /&gt;</code></td><td><input type="radio" name="R1" value="2" /></td></tr>
        <tr><td><code class="html">&lt;input type="text" name="My Name" value="me" /&gt;</code></td><td><input type="text" name="My Name" value="me" /></td></tr>

        <tr><td class="hint" colspan="2">The reset input should never be serialized.  Prototype and MochiKit get this wrong.</td></tr>
        <tr><td><code class="html">&lt;input type="reset" name="reset" value="NO" /&gt;</code></td><td><input type="reset" name="reset" value="NO" /></td></tr>

        <tr><td class="hint" colspan="2">Normal <strong>Single</strong> select elements are handled correctly by each of the libraries.</td></tr>

        <tr><td><code class="html">&lt;select name="S1"&gt;</code> <em>(100 options)</em></td><td>
            <select name="S1">
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

            </select>
        </td></tr>            
        <tr><td class="hint" colspan="2">Normal <strong>multiple</strong> select elements are handled correctly by each of the libraries.</td></tr>
        <tr><td><code class="html">&lt;select name="S2" multiple="multiple" size="3"&gt;</code> <em>(100 options)</em></td><td>
            <select name="S2" multiple="multiple" size="3">
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>

                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
                <option value="abc">ABC</option>
        </select></td></tr>

        <tr><td class="hint" colspan="2">The following select element has a selected option with no value attribute.  The option text value should be submitted.  
            <code class="inline">S3=YES</code> is correct.  <code class="inline">S3=</code> is incorrect.  dojo gets this wrong in IE.</td></tr>

        <tr><td><code class="html">&lt;select name="S3"&gt;&lt;option selected="selected"&gt;YES&lt;/option&gt;&lt;/select&gt;</code></td><td><select name="S3">
            <option selected="selected">YES</option>
        </select></td></tr>
        <tr><td class="hint" colspan="2">The following select element has a selected option with a value attribute set to "".  <code class="inline">S4=</code> is correct.  <code class="inline">S4=NO</code> is incorrect.  
            </td></tr>

        <tr><td><code class="html">&lt;select name="S4"&gt;&lt;option value="" selected="selected"&gt;NO&lt;/option&gt;&lt;/select&gt;</code></td><td><select name="S4">
            <option value="" selected="selected">NO</option>
        </select></td></tr>
        <tr><td class="hint" colspan="2">The following select element has its <code class="inline">selectedIndex</code> property set to <code class="inline">-1</code> before serialization. 
            It should not be submitted.  dojo and MochiKit get this wrong.</td></tr>

        <tr><td><code class="html">&lt;select name="S5"&gt;&lt;option value="NO"&gt;NO&lt;/option&gt;&lt;/select&gt;</code></td>
            <td><select id="S5" name="S5"><option value="NO">NO</option></select></td></tr>
        <tr><td class="hint" colspan="2">Submit elements should only appear in the query string when they are the element used to submit the form.  Only jQuery and dojo get this right. 
            YUI always includes the first submit element.  Prototype sends all the input submit elements (but not button submit elements).
            MochiKit sends them all.</td></tr>
        <tr><td><code class="html">&lt;input type="submit"  name="sub1" value="NO" /&gt;</code></td><td><input type="submit"  name="sub1" value="NO" /></td></tr>
        <tr><td><code class="html">&lt;input type="submit"  name="sub2" value="NO" /&gt;</code></td><td><input type="submit"  name="sub2" value="NO" /></td></tr>

        <tr><td><code class="html">&lt;input type="image"   name="sub3" src="submit.gif" value="NO" /&gt;</code></td><td><input type="image" name="sub3" value="NO" src="submit.gif" /></td></tr>
        <tr><td><code class="html">&lt;button type="submit" name="sub4" value="NO"&gt;NO&lt;/button&gt;</code></td><td><button name="sub4" type="submit" value="NO">NO</button></td></tr>

        <tr><td class="hint" colspan="2">Disabled elements should never be submitted.  MochiKit and mootools get this wrong.</td></tr>
        <tr><td><code class="html">&lt;input type="text" name="D1" value="NO" <span class="dis">disabled="disabled"</span> /&gt;</code></td><td><input name="D1" type="text" value="NO" disabled="disabled" /></td></tr>

        <tr><td><code class="html">&lt;input type="checkbox" name="D2" value="NO" checked="checked" <span class="dis">disabled="disabled"</span> /&gt;</code></td><td><input type="checkbox" checked="checked" disabled="disabled" name="D2" value="NO" /></td></tr>
        <tr><td><code class="html">&lt;input type="radio" name="D3" value="NO" checked="checked" <span class="dis">disabled="disabled"</span> /&gt;</code></td><td><input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" /></td></tr>
        <tr><td><code class="html">&lt;select name="D4"&gt;&lt;option selected="selected" value="NO" <span class="dis">disabled="disabled"</span>&gt;NO&lt;/option&gt;</code></td><td><select name="D4" disabled="disabled">

            <option selected="selected" value="NO">NO</option>
        </select></td></tr>
        <tr><td class="hint" colspan="2">Inputs with a type attribute of something other than<br />
        PASSWORD | CHECKBOX | RADIO | SUBMIT | RESET | FILE | HIDDEN | IMAGE | BUTTON<br />
        should be treated as TEXT inputs.
        </td></tr>
        <tr><td><code class="html">&lt;input type="bogus"  name="TYPE-TEST" value="YES" /&gt;</code></td><td><input type="bogus" name="TYPE-TEST" value="YES" /></td></tr>
        <tr><td><code class="html">&lt;input type="search" name="SEARCH" value="YES" /&gt;</code></td><td><input type="search" name="SEARCH" value="YES" /></td></tr>
        </table>
    </div></form>
    <p />
    <h1>Notes</h1>
    This test page does not expose serialization problems that occur during an actual form submit.  These include:
    <p />

    <ul>
    <li>YUI, Prototype and MochiKit do not support input elements of <code class="inline">type="image"</code>.</li>
    <li>dojo does not capture the click coordinates of input elements of <code class="inline">type="image"</code>.  However, it does correctly recognize it as the submitting element.</li>
    <li>dojo does not properly support semantic serialization when the form contains an input of <code class="inline">type="image"</code>.  When such an element is used to submit
        the form, it will always appear last in the query string regardless of its semantic position. (This is likely a very
        low-percentage use case.)</li>

    <li>mootools is not compatible with Prototype and is not included on this test page.  A test page that includes mootools can be found <a href="moo.html">here</a>.
        In summary, mootools does not support semantic serialization and it incorrectly submits disabled fields.
    </li>
    </ul>
    <p />
    <h1>Encoding</h1>
    Each of the libraries tested use JavaScript's <code class="inline">encodeURIComponent</code><sup>[2]</sup> function to encode form data. 
        Technically, this does not conform to the HTML spec <a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1">which  
        states</a> the following
        about the <code class="inline">application/x-www-form-urlencoded</code> content type (emphasis added):
        <blockquote>

        This is the default content type. Forms submitted with this content type must be encoded as follows:<br />
        <ol>
        <li>Control names and values are escaped. <strong>Space characters are replaced by `+'</strong>, and then reserved 
        characters are escaped as described in <a href="http://www.w3.org/TR/html401/references.html#ref-RFC1738">[RFC1738]</a>, 
        section 2.2: Non-alphanumeric characters are 
        replaced by `%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. 
        <strong>Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A')</strong>.</li>
        <li>The control names/values are listed in the order they appear in the document. The name is separated 
        from the value by `=' and name/value pairs are separated from each other by '&amp;'.</li>

        </ol>
        </blockquote>
        While this does not seem to cause any problems, it is interesting and noteworthy.
    <p />
    <h1>Links</h1>
    <ul>
        <li><a href="http://jquery.com">jQuery</a></li>
        <li><a href="http://www.dojotoolkit.com/">dojo</a></li>

        <li><a href="http://developer.yahoo.com/yui/">YUI</a></li>
        <li><a href="http://mochikit.com/">MochiKit</a></li>
        <li><a href="http://prototypejs.org/">Prototype</a></li>
        <li><a href="http://mootools.net/">mootools</a></li>
    </ul>
    <div id="footer">
    [1] Timing numerous iterations of the form serialization process is a contrived test case.  
    This is not something that would ever be done with a real form (I hope).  And this is why there
    is an option of 1 in the iterations combobox - so you can run only a single pass if you like.  
    Running numerous iterations simply makes it easier to compare the relative performance 
    of the libraries tested.
    <p />

    [2] dojo optionally will encode form data in ascii format (using dojo.string.encodeAscii).
    </div>
</div>
</body>
</html>