Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36
Chrome 74
Windows
Desktop
5 years ago
Test name Executions per second
$.hasClass 621997.5 Ops/sec
RegExp 3602364.0 Ops/sec
Dry RegExp 1213128.8 Ops/sec
indexOf 4492660.5 Ops/sec
classList 3660187.8 Ops/sec
hasClassString 2755913.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString


;