Commit 423d79b3 authored by Tom Quirk's avatar Tom Quirk Committed by Lukas Eipert

Use connectedCallback to initialise GlEmoji

Attributes may not be available in the constructor.
This causes problems, as data attributes,
like emoji name, may not be available when we need them.
Race conditions may be present which means emojis
may not render.

This commit uses the connectedCallback,
which will ensure the element has been mounted to the DOM
before we initialize the emoji.
parent 7fffa6e9
...@@ -3,9 +3,7 @@ import isEmojiUnicodeSupported from '../emoji/support'; ...@@ -3,9 +3,7 @@ import isEmojiUnicodeSupported from '../emoji/support';
import { initEmojiMap, getEmojiInfo, emojiFallbackImageSrc, emojiImageTag } from '../emoji'; import { initEmojiMap, getEmojiInfo, emojiFallbackImageSrc, emojiImageTag } from '../emoji';
class GlEmoji extends HTMLElement { class GlEmoji extends HTMLElement {
constructor() { connectedCallback() {
super();
this.initialize(); this.initialize();
} }
initialize() { initialize() {
......
---
title: Fix emoji rendering in certain edge cases
merge_request: 44542
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment