Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js

Issue 2057353002: WebUI: cr-search-field, do not call delegate if search query did not change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded check. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
diff --git a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
index 3657f79f2600b74d83b7b4e4f754df3d87c44b32..db59baee17aaf1e7f2137c7ce3974c4729be0cb7 100644
--- a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
+++ b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
@@ -38,6 +38,12 @@ var CrSearchFieldBehavior = {
},
hasSearchText: Boolean,
+
+ /** @private */
+ lastValue_: {
+ type: String,
+ value: '',
+ },
},
/**
@@ -74,9 +80,13 @@ var CrSearchFieldBehavior = {
},
onSearchTermSearch: function() {
- this.hasSearchText = this.getValue() != '';
- if (this.delegate_)
- this.delegate_.onSearchTermSearch(this.getValue());
+ var newValue = this.getValue();
Dan Beam 2016/06/14 15:47:29 var newValue = this.getValue(); if (newValue == th
dpapad 2016/06/14 17:21:50 Done.
+ this.hasSearchText = newValue != '';
+ if (newValue != this.lastValue_) {
+ if (this.delegate_)
+ this.delegate_.onSearchTermSearch(newValue);
+ this.lastValue_ = newValue;
+ }
},
onSearchTermKeydown: function(e) {

Powered by Google App Engine
This is Rietveld 408576698