Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36
Chrome 104
Linux
Desktop
2 years ago
Test name Executions per second
$.hasClass 805057.8 Ops/sec
RegExp 3571009.0 Ops/sec
Dry RegExp 1139960.4 Ops/sec
indexOf 4337256.0 Ops/sec
classList 3585690.0 Ops/sec
hasClassString 2435657.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString