Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36
Chrome 72
Windows 7
Desktop
5 years ago
Test name Executions per second
$.hasClass 650315.3 Ops/sec
RegExp 3262179.0 Ops/sec
Dry RegExp 961847.1 Ops/sec
indexOf 3890548.5 Ops/sec
classList 2770105.8 Ops/sec
hasClassString 2418579.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString