From ea9f607bba6c0cf390d1f867768ef6f53ef40675 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 28 Oct 2015 15:46:47 -0700 Subject: [PATCH] [Representation] Handle undefined scope element.scope() may be undefined when wiring in the info gesture, so check for that. That this is sometimes undefined appears to be a consequence of changes to mct-representation, but which changes influence this are unclear. In any event, it appears that this cannot be relied-upon per https://github.com/angular/angular.js/issues/9515 --- .../commonUI/inspect/src/gestures/InfoGesture.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index 09740841e49..6be25e646db 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -55,11 +55,6 @@ define( self.trackPosition(event); }; - // Also make sure we dismiss bubble if representation is destroyed - // before the mouse actually leaves it - this.scopeOff = - element.scope().$on('$destroy', this.hideBubbleCallback); - this.element = element; this.$timeout = $timeout; this.infoService = infoService; @@ -131,6 +126,13 @@ define( this.pendingBubble = this.$timeout(displayBubble, this.delay); this.element.on('mouseleave', this.hideBubbleCallback); + + // Also make sure we dismiss bubble if representation is destroyed + // before the mouse actually leaves it + this.scopeOff = + this.element.scope() && + this.element.scope().$on('$destroy', this.hideBubbleCallback); + }; @@ -143,7 +145,9 @@ define( this.hideBubble(); // ...and detach listeners this.element.off('mouseenter', this.showBubbleCallback); - this.scopeOff(); + if (this.scopeOff) { + this.scopeOff(); + } }; return InfoGesture;