From 958e94cdd14595bfa5b4ddc5d8e2d388060dabe2 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Sun, 9 Feb 2014 16:00:43 -0800 Subject: [PATCH] Fixing clear search on command+a. --- lib/js/views/search_box.js | 6 ++---- lib/js/views/search_input.js | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/js/views/search_box.js b/lib/js/views/search_box.js index 6a95535..596ed00 100644 --- a/lib/js/views/search_box.js +++ b/lib/js/views/search_box.js @@ -145,9 +145,7 @@ VS.ui.SearchBox = Backbone.View.extend({ // since its position is unknown by the time the collection triggers this // remove callback. removedFacet : function (facet, query, options) { - if (this.app.options.callbacks.removedFacet) { - this.app.options.callbacks.removedFacet(facet, query, options); - } + this.app.options.callbacks.removedFacet(facet, query, options); }, // Renders each facet as a searchFacet view. @@ -222,7 +220,7 @@ VS.ui.SearchBox = Backbone.View.extend({ this.focusSearch(e); }, this); - if (this.app.options.callbacks.clearSearch) { + if (this.app.options.callbacks.clearSearch != $.noop) { this.app.options.callbacks.clearSearch(actualClearSearch); } else { actualClearSearch(); diff --git a/lib/js/views/search_input.js b/lib/js/views/search_input.js index a9e0d66..0c09ccc 100644 --- a/lib/js/views/search_input.js +++ b/lib/js/views/search_input.js @@ -320,11 +320,9 @@ VS.ui.SearchInput = Backbone.View.extend({ this.box.trigger('resize.autogrow', e); var query = this.box.val(); var prefixes = []; - if (this.app.options.callbacks.facetMatches) { - this.app.options.callbacks.facetMatches(function(p) { - prefixes = p; - }); - } + this.app.options.callbacks.facetMatches(function(p) { + prefixes = p; + }); var labels = _.map(prefixes, function(prefix) { if (prefix.label) return prefix.label; else return prefix;