data-validate

JavaScript performance comparison

Test case created by bibu

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//jzaefferer.github.com/jquery-validation/jquery.validate.js">
</script>

<script src="//jquery-values.googlecode.com/svn-history/r90/other/hint/jquery.metadata.js">
</script>

<form id="myForm">
    <input name="foo" type="text" data-validate="{required:true,digits:true}" />
<input name="foo2" type="text" data-validate="{required:true,digits:true}" />
<input name="foo3" type="text" data-validate="{required:true,digits:true}" />
<input name="foo4" type="text" data-validate="{required:true,digits:true}" />
<input name="foo5" type="text" data-validate="{required:true,digits:true}" />
<input name="foo6" type="text" data-validate="{required:true,digits:true}" />
    <input type="submit">
</form>

<form id="myForm1">
    <input name="foo" type="text" class="required digits" />
<input name="foo1" type="text" class="required digits" />
<input name="foo2" type="text" class="required digits" />
<input name="foo3" type="text" class="required digits" />
<input name="foo4" type="text" class="required digits" />
<input name="foo5" type="text" class="required digits" />
<input name="foo6" type="text" class="required digits" />

    <input type="submit">
</form>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
with data validate
$.metadata.setType("html5");
$('#myForm').validate({
    meta: "validate"
});
$('#myForm').trigger('submit');
pending…
with class
$('#myForm1').validate();
$('#myForm1').trigger('submit');
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment