diff options
Diffstat (limited to 'web-ui/app/js/tags/ui/tag_shortcut.js')
-rw-r--r-- | web-ui/app/js/tags/ui/tag_shortcut.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/web-ui/app/js/tags/ui/tag_shortcut.js b/web-ui/app/js/tags/ui/tag_shortcut.js index 6e5c6960..59556794 100644 --- a/web-ui/app/js/tags/ui/tag_shortcut.js +++ b/web-ui/app/js/tags/ui/tag_shortcut.js @@ -3,10 +3,11 @@ define( 'flight/lib/component', 'views/templates', 'page/events', - 'tags/ui/tag_base' + 'tags/ui/tag_base', + 'flight/lib/utils' ], - function (describeComponent, templates, events, tagBase) { + function (describeComponent, templates, events, tagBase, utils) { var TagShortcut = describeComponent(tagShortcut, tagBase); @@ -20,7 +21,6 @@ define( function tagShortcut() { - this.renderAndAttach = function (parent, options) { var linkTo = options.linkTo; @@ -58,9 +58,16 @@ define( this.$node.addClass('selected'); }; + this.doTeardown = function () { + if (!jQuery.contains(document, this.$node[0])) { + this.teardown(); + } + }; + this.after('initialize', function () { this.on('click', function () { this.attr.trigger.triggerSelect(); }); this.on(document, events.ui.tag.select, this.selectTag); + this.on(document, events.tags.shortcuts.teardown, this.doTeardown); }); } |