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({
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;
}

View file

@ -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%;