Use length instead of the first element

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-02-23 07:49:26 +01:00
parent c9baff1e10
commit ce1be7a4cd
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 1 additions and 1 deletions

View File

@ -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 <pre> so that the copy button can be correctly positioned