From ce1be7a4cdcace08bac8cd18a1569a59f58f4b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 23 Feb 2021 07:49:26 +0100 Subject: [PATCH] Use length instead of the first element MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/messages/TextualBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 5be4a6bbb4..63d287870e 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -100,7 +100,7 @@ export default class TextualBody extends React.Component { // This happens after the codeblock was edited. if (pres[i].parentNode.className == "mx_EventTile_pre_container") continue; // Add code element if it's missing - if (!pres[i].getElementsByTagName("code")[0]) { + if (pres[i].getElementsByTagName("code").length == 0) { this._addCodeElement(pres[i]); } // Wrap a div around
 so that the copy button can be correctly positioned