Use length instead of the first element

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Š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

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