Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
jQuery hasClass vs vanilla JS classList.contains
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 132
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
jQuery hasClass
702160.1 Ops/sec
Vanilla JS classList.contains
4021423.5 Ops/sec
HTML Preparation code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <div id="el" class="test"></div>
Tests:
jQuery hasClass
$("#el").hasClass("test");
Vanilla JS classList.contains
document.getElementById("el").classList.contains("test");