Fix(SideContainerToggler.js): Check if the component exists on init

This commit is contained in:
yanas 2017-04-06 13:25:11 -05:00 committed by Lyubo Marinov
parent 8be85de6ef
commit cb0eef9edd
1 changed files with 17 additions and 7 deletions

View File

@ -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);
},
/**