Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Firefox 68
Windows
Desktop
5 years ago
Test name Executions per second
$.hasClass 1904358.4 Ops/sec
RegExp 9573865.0 Ops/sec
Dry RegExp 2361367.2 Ops/sec
indexOf 9805463.0 Ops/sec
classList 13925614.0 Ops/sec
hasClassString 6392971.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString