From 9ed6cd57f3a4c7a845746fc969f47a9bfbd92ae4 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 1 Jul 2021 00:01:38 +0530 Subject: [PATCH] use textContent Signed-off-by: RMidhunSuresh --- src/platform/web/ui/avatar.js | 7 ++----- src/platform/web/ui/css/avatar.css | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/platform/web/ui/avatar.js b/src/platform/web/ui/avatar.js index bda44db0..36d9b172 100644 --- a/src/platform/web/ui/avatar.js +++ b/src/platform/web/ui/avatar.js @@ -25,8 +25,7 @@ export function renderStaticAvatar(vm, size, extraClasses = undefined) { let avatarClasses = classNames({ avatar: true, [`size-${size}`]: true, - [`usercolor${vm.avatarColorNumber}`]: true, - ['has-image']: true + [`usercolor${vm.avatarColorNumber}`]: true }); if (extraClasses) { avatarClasses += ` ${extraClasses}`; @@ -50,7 +49,5 @@ export function handleAvatarError(e) { if (!isAvatarEvent(e)) { return; } const parent = e.target.parentElement; const avatarLetter = parent.getAttribute("data-avatar-letter"); - const letterNode = document.createTextNode(avatarLetter); - parent.appendChild(letterNode); - parent.classList.remove("has-image"); + parent.textContent = avatarLetter; } diff --git a/src/platform/web/ui/css/avatar.css b/src/platform/web/ui/css/avatar.css index 85d370b7..d369f85f 100644 --- a/src/platform/web/ui/css/avatar.css +++ b/src/platform/web/ui/css/avatar.css @@ -31,10 +31,6 @@ limitations under the License. speak: none; } -.hydrogen .avatar:not(.has-image) img{ - display: none; -} - .hydrogen .avatar img { width: 100%; height: 100%;