From fbf26be8c68fb4950e7e78e3d61d568d13b6a74a Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 11 May 2020 02:58:48 +0200 Subject: [PATCH] Instantiate box explicitly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Antonin Décimo. --- static/sfu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/sfu.js b/static/sfu.js index da37a4a..767fec2 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -809,8 +809,8 @@ function addToChatbox(peerId, nick, message, me){ delete(lastMessage.peerId); } - document.getElementById('box').appendChild(container); - + let box = document.getElementById('box'); + box.appendChild(container); if(box.scrollHeight > box.clientHeight) { box.scrollTop = box.scrollHeight - box.clientHeight; }