Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
Chrome 76
Linux
Desktop
5 years ago
Test name Executions per second
$.hasClass 398561.2 Ops/sec
RegExp 2144359.2 Ops/sec
Dry RegExp 578502.8 Ops/sec
indexOf 2445866.8 Ops/sec
classList 2085166.0 Ops/sec
hasClassString 1361586.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString