From cb0eef9edd3bcc600ce350e8a75c1c0b5fd14932 Mon Sep 17 00:00:00 2001 From: yanas Date: Thu, 6 Apr 2017 13:25:11 -0500 Subject: [PATCH] Fix(SideContainerToggler.js): Check if the component exists on init --- .../UI/side_pannels/SideContainerToggler.js | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/modules/UI/side_pannels/SideContainerToggler.js b/modules/UI/side_pannels/SideContainerToggler.js index 763d07d41..b845a59e5 100644 --- a/modules/UI/side_pannels/SideContainerToggler.js +++ b/modules/UI/side_pannels/SideContainerToggler.js @@ -16,17 +16,27 @@ const SideContainerToggler = { init(eventEmitter) { this.eventEmitter = eventEmitter; - // Adds a listener for the animation end event that would take care - // of hiding all internal containers when the extendedToolbarPanel is + // We may not have a side toolbar container, for example, in + // filmstrip-only mode. + const sideToolbarContainer + = document.getElementById("sideToolbarContainer"); + + if (!sideToolbarContainer) + return; + + // Adds a listener for the animationend event that would take care of + // hiding all internal containers when the extendedToolbarPanel is // closed. - document.getElementById("sideToolbarContainer") - .addEventListener("animationend", function(e) { - if(e.animationName === "slideOutExt") + sideToolbarContainer.addEventListener( + "animationend", + function(e) { + if (e.animationName === "slideOutExt") $("#sideToolbarContainer").children().each(function() { if ($(this).hasClass("show")) SideContainerToggler.hideInnerContainer($(this)); }); - }, false); + }, + false); }, /** @@ -134,4 +144,4 @@ const SideContainerToggler = { } }; -export default SideContainerToggler; \ No newline at end of file +export default SideContainerToggler;