Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Linux
Desktop
5 years ago
Test name Executions per second
$.hasClass 2352547.5 Ops/sec
RegExp 10599487.0 Ops/sec
Dry RegExp 3370643.8 Ops/sec
indexOf 11026486.0 Ops/sec
classList 15378939.0 Ops/sec
hasClassString 7217235.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString