JQuery CSS coding

JavaScript performance comparison

Test case created

Info

.CSS vs .attr with 'style'

Preparation code

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

<div id="attr"><p>attr</p></div>
<div id="attr2"><p>attr2</p></div>
<div id="css"><p>css</p></div>

Preparation code output

attr

attr2

css

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
attr height
$('#attr').height(30).attr( 'style', 'color:red;');
pending…
Attr
$('#attr2').attr( 'style', 'height:30px; color:red;');
pending…
CSS
$('#css').css( 'height', '30px').css( 'color', 'red');
pending…

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

Compare results of other browsers

0 comments

Add a comment