Commit 4dc45702 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'tz-update-register-element-for-emojis' into 'master'

Updated document-register-element and registering emojis in the new way

See merge request gitlab-org/gitlab-ce!24899
parents bb0e50d6 8377bf7b
import installCustomElements from 'document-register-element'; import 'document-register-element';
import isEmojiUnicodeSupported from '../emoji/support'; import isEmojiUnicodeSupported from '../emoji/support';
installCustomElements(window); class GlEmoji extends HTMLElement {
constructor() {
super();
export default function installGlEmojiElement() {
const GlEmojiElementProto = Object.create(HTMLElement.prototype);
GlEmojiElementProto.createdCallback = function createdCallback() {
const emojiUnicode = this.textContent.trim(); const emojiUnicode = this.textContent.trim();
const { name, unicodeVersion, fallbackSrc, fallbackSpriteClass } = this.dataset; const { name, unicodeVersion, fallbackSrc, fallbackSpriteClass } = this.dataset;
...@@ -43,9 +42,11 @@ export default function installGlEmojiElement() { ...@@ -43,9 +42,11 @@ export default function installGlEmojiElement() {
}); });
} }
} }
}; }
}
document.registerElement('gl-emoji', { export default function installGlEmojiElement() {
prototype: GlEmojiElementProto, if (!customElements.get('gl-emoji')) {
}); customElements.define('gl-emoji', GlEmoji);
}
} }
...@@ -3264,10 +3264,12 @@ doctrine@^2.1.0: ...@@ -3264,10 +3264,12 @@ doctrine@^2.1.0:
dependencies: dependencies:
esutils "^2.0.2" esutils "^2.0.2"
document-register-element@1.3.0: document-register-element@1.13.1:
version "1.3.0" version "1.13.1"
resolved "https://registry.yarnpkg.com/document-register-element/-/document-register-element-1.3.0.tgz#fb3babb523c74662be47be19c6bc33e71990d940" resolved "https://registry.yarnpkg.com/document-register-element/-/document-register-element-1.13.1.tgz#dad8cb7be38e04ee3f56842e6cf81af46c1249ba"
integrity sha1-+zurtSPHRmK+R74Zxrwz5xmQ2UA= integrity sha512-92ZyLDKg9j4rOll//NNXj25f+8rAzOkYsGJonhugKwXfeqH7bzs8Ucpvey0WzZ2ZzKdrvW9RnUw3UyOZ/uhBFw==
dependencies:
lightercollective "^0.1.0"
dom-serialize@^2.2.0: dom-serialize@^2.2.0:
version "2.2.1" version "2.2.1"
......
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