Run details:
Mozilla/5.0 (Linux; Android 11; GM1903) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36
Chrome Mobile 109
Android
Mobile
one year ago
Test name Executions per second
querySelectorAll with .class 381.8 Ops/sec
querySelectorAll with [attribute] 129.7 Ops/sec
filter with classList 14.5 Ops/sec
filter with className 41.8 Ops/sec
filter with getAttribute 34.1 Ops/sec
for with classList 9.4 Ops/sec
for with className 11.2 Ops/sec
for with getAttribute 10.8 Ops/sec
getElementsByClassName 361145.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • querySelectorAll with .class

  • querySelectorAll with [attribute]

  • filter with classList

  • filter with className

  • filter with getAttribute

  • for with classList

  • for with className

  • for with getAttribute

  • getElementsByClassName