Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Firefox 57
Windows 8.1
Other
2025 years ago
Test name Executions per second
$.hasClass 196249.5 Ops/sec
RegExp 2297700.0 Ops/sec
Dry RegExp 112629.4 Ops/sec
indexOf 1795062.5 Ops/sec
classList 3905357.2 Ops/sec
hasClassString 2918729.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString