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

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

Issue 2571583004: MD WebUI: Delete cr-search-field, simplify CrSearchFieldBehavior (Closed)
Patch Set: Use focus_() Created 4 years 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 f494663bd8dce57cd37d3de2a9805b742632dd1d..68c15d4ff6146d481f0c60d025cb8dfaa58dc179 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
@@ -3,8 +3,8 @@
// found in the LICENSE file.
/**
- * Implements an incremental search field which can be shown and hidden.
- * Canonical implementation is <cr-search-field>.
+ * Helper functions for implementing an incremental search field. See
+ * <settings-subpage-search> for a simple implementation.
* @polymerBehavior
*/
var CrSearchFieldBehavior = {
@@ -19,14 +19,6 @@ var CrSearchFieldBehavior = {
value: '',
},
- showingSearch: {
- type: Boolean,
- value: false,
- notify: true,
- observer: 'showingSearchChanged_',
- reflectToAttribute: true
- },
-
/** @private */
lastValue_: {
type: String,
@@ -57,23 +49,9 @@ var CrSearchFieldBehavior = {
setValue: function(value, opt_noEvent) {
var searchInput = this.getSearchInput();
searchInput.value = value;
- // If the input is an iron-input, ensure that the new value propagates as
- // expected.
- if (searchInput.bindValue != undefined)
- searchInput.bindValue = value;
this.onValueChanged_(value, !!opt_noEvent);
},
- showAndFocus: function() {
- this.showingSearch = true;
- this.focus_();
- },
-
- /** @private */
- focus_: function() {
- this.getSearchInput().focus();
- },
-
onSearchTermSearch: function() {
this.onValueChanged_(this.getValue(), false);
},
@@ -95,28 +73,4 @@ var CrSearchFieldBehavior = {
if (!noEvent)
this.fire('search-changed', newValue);
},
-
- onSearchTermKeydown: function(e) {
- if (e.key == 'Escape')
- this.showingSearch = false;
- },
-
- /**
- * @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;
- }
-
- this.setValue('');
- this.getSearchInput().blur();
- }
};

Powered by Google App Engine
This is Rietveld 408576698