BSI.id().setStyle() vs jQuery.css() vs. native DOM (v31)

Revision 31 of this benchmark created on


Preparation HTML

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

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://bytes1.dyndns.org/BSI/website-app.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
BSI.id().setStyle()
BSI.id('box').setStyle({
  background: "#FF0000",
  "box-shadow": "1px 1px 5px 5px red",
  width: "100px",
  height: "100px",
  display: "block"
});
ready
jQuery.css()
$('#box').css({
  background: "#FF0000",
  "box-shadow": "1px 1px 5px 5px red",
  width: "100px",
  height: "100px",
  display: "block"
});
ready
Native DOM
var el = document.getElementById("box");

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
Native DOM, set style directly
var el = document.getElementById("box");

el.setAttribute('style', 'background: #FF0000; width: 100px; height: 100px; display: block; box-shadow: 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.