Event delegation: Dojo versus jQuery

JavaScript performance comparison

Test case created by Josiel Rocha

Preparation code

<!-- jQuery 1.11 //-->
<!-- Dojo 1.9.3 //-->

<div id="myDiv">
    <ul>
        <li>
            <a href="http://www.google.com.br">Google</a>
        </li>
    </ul>
</div>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
 <script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/dojo.js"></script>
 

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
Dojo
require(['dojo/query', 'dojo/on'], function(query, on) {
  var div = query('#myDiv'),
    link = div.query('a');

  div.on('a:click', function(ev) {
    console.log(arguments, this);

    ev.stop();
  });
})
pending…
jQuery
var div = $('#myDiv'),
  link = div.find('a');

div.on('click', 'a', function(ev) {
  console.log(arguments, this);
  ev.preventDefault();
});
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