Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
Chrome 58
Windows
Other
6 years ago
Test name Executions per second
$.hasClass 637180.3 Ops/sec
RegExp 5761533.0 Ops/sec
Dry RegExp 2360387.5 Ops/sec
indexOf 6456377.5 Ops/sec
classList 6548678.5 Ops/sec
hasClassString 4207143.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString