Check hidden (v7)

Revision 7 of this benchmark created on


Preparation HTML

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


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

Setup

var el = document.getElementById("test");

Test runner

Ready to run.

Testing in
TestOps/sec
el.offsetParent !== null
var visible = el.offsetParent !== null
ready
el.offsetHeight > 0
var visible = el.offsetHeight > 0
ready
el.offsetParent, el.offsetHeight
var visible = el.offsetParent !== null && el.offsetHeight > 0
ready
getComputedStyle
var visible = window.getComputedStyle(el).display !== 'none'
ready
jquery
var visible = $(el).is(':visible')
ready

Revisions

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