Run details:
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Chrome 70
Windows 7
Desktop
6 years ago
Test name Executions per second
$.hasClass 541729.6 Ops/sec
RegExp 2574253.2 Ops/sec
Dry RegExp 862721.2 Ops/sec
indexOf 2880950.5 Ops/sec
classList 2195506.2 Ops/sec
hasClassString 1946181.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString