Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0
Firefox 95
Windows 7
Desktop
2 years ago
Test name Executions per second
$.hasClass 3683147.8 Ops/sec
RegExp 15440342.0 Ops/sec
Dry RegExp 5013712.0 Ops/sec
indexOf 16415416.0 Ops/sec
classList 17896288.0 Ops/sec
hasClassString 9395977.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString