diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-03-03 07:34:48 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-03-06 21:54:46 +0300 |
commit | 2d6492561c8b34595abc3638f8991d7aa6af7151 (patch) | |
tree | 0ffec5c92336649805d316530ce1ac5d222a6639 /app/assets/javascripts/awards_handler.js | |
parent | c4801e2a16277c619a2b6fac36537e0f38a52abf (diff) |
Fix up potential for build finish event to fire for wrong menu
Diffstat (limited to 'app/assets/javascripts/awards_handler.js')
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index d7beb246288..4667980a960 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -154,8 +154,7 @@ AwardsHandler.prototype.showEmojiMenu = function showEmojiMenu($addBtn) { }; // Create the emoji menu with the first category of emojis. -// Then after the emoji menu has been expanded(and CSS transition has ended), -// render the remaining categories of emojis one by one to avoid jank. +// Then render the remaining categories of emojis one by one to avoid jank. AwardsHandler.prototype.createEmojiMenu = function createEmojiMenu(callback) { if (this.isCreatingEmojiMenu) { return; @@ -199,7 +198,8 @@ AwardsHandler // Avoid the jank and render the remaining categories separately // This will take more time, but makes UI more responsive - const emojiContentElement = document.querySelector('.emoji-menu .emoji-menu-content'); + const menu = document.querySelector('.emoji-menu'); + const emojiContentElement = menu.querySelector('.emoji-menu-content'); const remainingCategories = Object.keys(categoryMap).slice(1); const allCategoriesAddedPromise = remainingCategories.reduce( (promiseChain, categoryNameKey) => @@ -222,7 +222,6 @@ AwardsHandler allCategoriesAddedPromise.then(() => { // Used for tests // We check for the menu in case it was destroyed in the meantime - const menu = document.querySelector('.emoji-menu'); if (menu) { menu.dispatchEvent(new CustomEvent('build-emoji-menu-finish')); } |