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

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

Issue 2458113003: Prevent bogus 'search-changed' event firing from cr_search_field_behavior.js. (Closed)
Patch Set: ? -> undefined Created 4 years, 2 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
« no previous file with comments | « chrome/test/data/webui/cr_elements/cr_toolbar_search_field_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a5137e88ed11bf0d83c53d3f53eec68535092ea2..d87184144f6312a9d830bf2adeda1e446edddfc9 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
@@ -92,8 +92,16 @@ var CrSearchFieldBehavior = {
this.showingSearch = false;
},
- /** @private */
- showingSearchChanged_: function() {
+ /**
+ * @param {boolean} current
+ * @param {boolean|undefined} previous
+ * @private
+ */
+ showingSearchChanged_: function(current, previous) {
+ // Prevent unnecessary 'search-changed' event from firing on startup.
+ if (previous == undefined)
+ return;
+
if (this.showingSearch) {
this.focus_();
return;
« no previous file with comments | « chrome/test/data/webui/cr_elements/cr_toolbar_search_field_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698