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 1672749.0 Ops/sec
RegExp 7926486.5 Ops/sec
Dry RegExp 2084135.1 Ops/sec
indexOf 7400317.0 Ops/sec
classList 8853655.0 Ops/sec
hasClassString 4392369.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString