*:focus vs activeElement (v5)

Revision 5 of this benchmark created by SGUI on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<input type="text" id="test" />

Setup

document.getElementById("test").focus();

Test runner

Ready to run.

Testing in
TestOps/sec
querySelector(*:focus)
var focussed = $("#test:focus");
ready
document.activeElement
var focussed = document.activeElement.hasFocus && document.activeElement;
ready

Revisions

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