jquery vs createElement (v109)

Revision 109 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery
var test = $("<img class='slide' style='position: absolute; left: 0; top:0; width:100%;height:100%;object-fit:contain;background-color:#000;src:slides;alt:slides'/>");
ready
createElement
var test = $(document.createElement('img'));
ele.css({
  position: 'absolute',
  left: 0,
  top: 0,
  width: '100%',
  height: '100%',
  objectFit: 'contain',
  backgroundColor: '#000'
}).addClass('slide').prop({
  src: 'slides[i]',
  alt: 'slides[i]'
});
var test = ele;
ready
jQuery another way
var test = $("<img />", {
  class: 'slide',
  style: 'position: absolute; left: 0; top:0; width:100%;height:100%;object-fit:contain;background-color:#000;src:slides;alt:slides'
});
ready

Revisions

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