Skip to content

A platform for community discussion. Free, open, simple.

REFACTOR: querySelector instead of querySelectorAll to get first node (#8861)

Joffrey JAFFEUXa9f1652131ba
diff --git a/app/assets/javascripts/discourse/components/topic-navigation.js.es6 b/app/assets/javascripts/discourse/components/topic-navigation.js.es6
index d0075b87f2f..bff5f73a2ee 100644
--- a/app/assets/javascripts/discourse/components/topic-navigation.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-navigation.js.es6
@@ -39,10 +39,8 @@ export default Component.extend(PanEvents, {
if (renderTimeline) {
const width = window.innerWidth,
composer = document.getElementById("reply-control"),
- timelineContainer = document.querySelectorAll(
- ".timeline-container"
- )[0],
- headerContainer = document.querySelectorAll(".d-header")[0],
+ timelineContainer = document.querySelector(".timeline-container"),
+ headerContainer = document.querySelector(".d-header"),
headerHeight = (headerContainer && headerContainer.offsetHeight) || 0;
if (timelineContainer && composer) {