Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0
Firefox 82
Windows
Desktop
4 years ago
Test name Executions per second
$.hasClass 2699028.8 Ops/sec
RegExp 12097325.0 Ops/sec
Dry RegExp 3162563.2 Ops/sec
indexOf 11934657.0 Ops/sec
classList 12141529.0 Ops/sec
hasClassString 6682784.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString