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 12; M2103K19G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Mobile Safari/537.36 OPR/64.1.3282.59829
Browser:
Opera Mobile 64
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
jQuery hasClass
313180.5 Ops/sec
Vanilla JS classList.contains
1103353.1 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");