use textContent

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-01 00:01:38 +05:30
parent 168b1d6247
commit 9ed6cd57f3
2 changed files with 2 additions and 9 deletions

View file

@ -25,8 +25,7 @@ export function renderStaticAvatar(vm, size, extraClasses = undefined) {
let avatarClasses = classNames({ let avatarClasses = classNames({
avatar: true, avatar: true,
[`size-${size}`]: true, [`size-${size}`]: true,
[`usercolor${vm.avatarColorNumber}`]: true, [`usercolor${vm.avatarColorNumber}`]: true
['has-image']: true
}); });
if (extraClasses) { if (extraClasses) {
avatarClasses += ` ${extraClasses}`; avatarClasses += ` ${extraClasses}`;
@ -50,7 +49,5 @@ export function handleAvatarError(e) {
if (!isAvatarEvent(e)) { return; } if (!isAvatarEvent(e)) { return; }
const parent = e.target.parentElement; const parent = e.target.parentElement;
const avatarLetter = parent.getAttribute("data-avatar-letter"); const avatarLetter = parent.getAttribute("data-avatar-letter");
const letterNode = document.createTextNode(avatarLetter); parent.textContent = avatarLetter;
parent.appendChild(letterNode);
parent.classList.remove("has-image");
} }

View file

@ -31,10 +31,6 @@ limitations under the License.
speak: none; speak: none;
} }
.hydrogen .avatar:not(.has-image) img{
display: none;
}
.hydrogen .avatar img { .hydrogen .avatar img {
width: 100%; width: 100%;
height: 100%; height: 100%;