HTML Preparation code:
x
 
1
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
2
<script>
3
    var $jq331 = $.noConflict(true);
4
</script>
5
6
<div id="box" style="background:#555;color:#FFF;position:absolute;left:0;top:0;width:400px;height:100px;</div>
Script Preparation code:
 
var elem = document.getElementById('box');
console.log("elem", elem);
console.log("jq", $jq331);
var jqElem = $jq331('#box')
console.log("jqElem", jqElem);
Tests:
  • cssText

     
    elem.style.cssText +=';width:300px;height:50px;';
  • style

     
    elem.style.width = '300px';
    elem.style.height = '50px';
    elem.style.top = '40px';
    elem.style.left = '90px';
  • jquery

     
    jqElem.css({ 'width': 300, 'height': 50, 'top':40, 'left': 90 });
  • object

     
    Object.assign(elem.style,{width:"300px",height:"50px",top:"40px",left:"90px"});
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    cssText
    style
    jquery
    object

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on Windows
View result in a separate tab
Test name Executions per second
cssText 41519.0 Ops/sec
style 268486.9 Ops/sec
jquery 56330.2 Ops/sec
object 299691.3 Ops/sec