jQuery.css() vs. native DOM (v62)

Revision 62 of this benchmark created on


Preparation HTML

<div id="box">I'm a box</div>

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

Setup

var el = document.getElementById("box");

Teardown



            el = null;
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.css()
$(el).css({
  background: "#FF0000",
  "box-shadow": "1px 1px 5px 5px red",
  width: "100px",
  height: "100px",
  display: "block"
});
ready
Native DOM
el.style.background = "#FF0000";
el.style.width = "100px";
el.style.height = "100px";
el.style.display = "block";
el.style.boxShadow = "1px 1px 5px 5px red";
ready
cssText
el.style.cssText += 'background: #FF0000; width: 100px; height: 100px; display: block; boxShadow: 1px 1px 5px 5px red;'
ready

Revisions

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