Check hidden (v10)

Revision 10 of this benchmark created on


Preparation HTML

<div>
    <div id="test">Hello there</div>
</div>

Setup

var el = document.getElementById("test");
    if(el.style.position != 'fixed') {
      el.style.position = 'fixed';
    } else {
      el.style.position = 'absolute';
    }

Test runner

Ready to run.

Testing in
TestOps/sec
el.offsetParent
var x = el.offsetParent;
ready
ComputedStyle
var x = window.getComputedStyle(el).display;
ready
Combo
var x;
if(el.style.position != 'fixed') {
  x = el.offsetParent;
} else {
  x = window.getComputedStyle(el).display;
}
ready

Revisions

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