Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
$.hasClass 830163.3 Ops/sec
RegExp 3693848.5 Ops/sec
Dry RegExp 1166499.1 Ops/sec
indexOf 4670570.5 Ops/sec
classList 3556886.0 Ops/sec
hasClassString 2628364.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString