height test (v6)

Revision 6 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script> var $jq17 = jQuery.noConflict( true ); </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script> var $jq18 = jQuery.noConflict( true ); </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script> var $jq19 = jQuery.noConflict( true ); </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script> var $jq110 = jQuery.noConflict( true ); </script>

<div id="myEl" style="height:35px;width:40px;border:3px solid red">Smaller</div>
<div id="myEl2" style="height:40px;width:40px;border:3px solid red">Taller</div>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery 1.7
var el = $jq17('#myEl');
var el2 = $jq17('#myEl2');

var firstHeight = el.height();
var secondHeight = el2.height();

if(firstHeight >= secondHeight) {
  el2.height(firstHeight);
} else {
  el.height(secondHeight);
}
ready
jQuery 1.8
var el = $jq18('#myEl');
var el2 = $jq18('#myEl2');

var firstHeight = el.height();
var secondHeight = el2.height();

if(firstHeight >= secondHeight) {
  el2.height(firstHeight);
} else {
  el.height(secondHeight);
}
ready
jQuery 1.9
var el = $jq19('#myEl');
var el2 = $jq19('#myEl2');

var firstHeight = el.height();
var secondHeight = el2.height();

if(firstHeight >= secondHeight) {
  el2.height(firstHeight);
} else {
  el.height(secondHeight);
}
ready
jQuery 1.10
var el = $jq110('#myEl');
var el2 = $jq110('#myEl2');

var firstHeight = el.height();
var secondHeight = el2.height();

if(firstHeight >= secondHeight) {
  el2.height(firstHeight);
} else {
  el.height(secondHeight);
}
ready
Alternative jQuery 1.8
var el = $jq18('#myEl');
var el2 = $jq18('#myEl2');

var firstHeight = el.css('height');
var secondHeight = el2.css('height');

if(firstHeight >= secondHeight) {
  el2.css('height',firstHeight);
} else {
  el.css('height',secondHeight);
}
ready

Revisions

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