Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Chrome 70
Windows
Desktop
6 years ago
Test name Executions per second
$.hasClass 820654.8 Ops/sec
RegExp 3319878.8 Ops/sec
Dry RegExp 1085910.0 Ops/sec
indexOf 3879725.0 Ops/sec
classList 2560336.2 Ops/sec
hasClassString 2621927.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString