Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15
Safari 13
Mac OS X 10.15
Desktop
4 years ago
Test name Executions per second
$.hasClass 1233800.8 Ops/sec
RegExp 3330798.5 Ops/sec
Dry RegExp 1504879.2 Ops/sec
indexOf 3605685.2 Ops/sec
classList 3533410.5 Ops/sec
hasClassString 1826665.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString