jquery css or csstext

JavaScript performance comparison

Test case created by datestyz

Preparation code

<div id="styleme">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
Benchmark.prototype.setup = function() {
    var $elem = $('#styleme');

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jquery css
  position: 'fixed',
  height: 1600,
  width: 1600,
  top: 0,
  'overflow': 'hidden'
$elem[0].style.cssText += ';'.concat('position:fixed;', 'height:1600px;', 'width:1600px;', 'top:0;', 'overflow:hidden;');

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

1 comment

Alex commented :

You did not put your CSS properties in quotes, so you are doing a prototype chain lookup on each of those. That will definitely affect the outcome.

Comment form temporarily disabled.

Add a comment