Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
Chrome 63
Windows
Other
2025 years ago
Test name Executions per second
$.hasClass 765564.9 Ops/sec
RegExp 3791607.8 Ops/sec
Dry RegExp 1234236.1 Ops/sec
indexOf 4275100.0 Ops/sec
classList 3168577.0 Ops/sec
hasClassString 2759426.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString