Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 OPR/74.0.3911.107
Opera 74
Linux
Desktop
3 years ago
Test name Executions per second
$.hasClass 827965.2 Ops/sec
RegExp 4357717.5 Ops/sec
Dry RegExp 1265651.4 Ops/sec
indexOf 5419815.5 Ops/sec
classList 4507473.0 Ops/sec
hasClassString 3301556.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString