Native Browser events vs jquery trigger

JavaScript performance comparison

Revision 12 of this test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="https://johnkpaul.github.com/jquery-simulate/jquery.simulate.js">
</script>
      
<script>
Benchmark.prototype.setup = function() {
  var $el = jQuery("<div id='test'></div>").appendTo("body");
  var el = $el.get(0);
  
  var events = [];
  document.addEventListener("click", function(e) {
  console.log("XXX");
    events.push(e);
  });

};

Benchmark.prototype.teardown = function() {
  $el.remove();

};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
jQuery trigger
$el.trigger("click");
pending…
jQuery triggerHandlers
$el.triggerHandler("click");
pending…
native event
pending…
native event through simulate plugin
pending…

Compare results of other browsers

Revisions

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

0 Comments