Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Mac OS X 10.13.3
Desktop
6 years ago
Test name Executions per second
$.hasClass 958578.4 Ops/sec
RegExp 4220855.5 Ops/sec
Dry RegExp 1328533.1 Ops/sec
indexOf 5101412.5 Ops/sec
classList 3792979.8 Ops/sec
hasClassString 3102539.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString