Prefer querySelector over getElementsByClassName or other live collection methods for element querying

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Description

While Document methods getElementsByClassName and getElementById are generally faster than querySelector, we should record our conventional use of querySelector in the Frontend style guide.

Links / references

  • jsPerf Benchmarks
Edited Sep 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading