Commit c9ba4f76 authored by Tim Zallmann's avatar Tim Zallmann

Moved Class to its own class

parent 17ad4f8f
import 'document-register-element';
import isEmojiUnicodeSupported from '../emoji/support';
export default function installGlEmojiElement() {
if (!customElements.get('gl-emoji')) {
customElements.define(
'gl-emoji',
class extends HTMLElement {
class GlEmoji extends HTMLElement {
constructor() {
super();
......@@ -18,11 +14,7 @@ export default function installGlEmojiElement() {
const hasImageFallback = fallbackSrc && fallbackSrc.length > 0;
const hasCssSpriteFalback = fallbackSpriteClass && fallbackSpriteClass.length > 0;
if (
emojiUnicode &&
isEmojiUnicode &&
!isEmojiUnicodeSupported(emojiUnicode, unicodeVersion)
) {
if (emojiUnicode && isEmojiUnicode && !isEmojiUnicodeSupported(emojiUnicode, unicodeVersion)) {
// CSS sprite fallback takes precedence over image fallback
if (hasCssSpriteFalback) {
if (!gon.emoji_sprites_css_added && gon.emoji_sprites_css_path) {
......@@ -51,7 +43,10 @@ export default function installGlEmojiElement() {
}
}
}
},
);
}
export default function installGlEmojiElement() {
if (!customElements.get('gl-emoji')) {
customElements.define('gl-emoji', GlEmoji);
}
}
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