Run details:
Mozilla/5.0 (Linux; Android 8.1.0; MI 6X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Mobile Safari/537.36
Chrome Mobile 89
Android 8.1.0
Mobile
3 years ago
Test name Executions per second
$.hasClass 370775.8 Ops/sec
RegExp 1333115.5 Ops/sec
Dry RegExp 487044.4 Ops/sec
indexOf 1602801.2 Ops/sec
classList 1388377.5 Ops/sec
hasClassString 979378.9 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString