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

Unified Diff: chrome/browser/resources/md_downloads/crisper.js

Issue 2180843006: MD WebUI: Remove local DOM access from CrSearchFieldBehavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr_search_field_clear
Patch Set: Vulcanize Created 4 years, 5 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 | « no previous file | ui/webui/resources/cr_elements/cr_search_field/cr_search_field.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_downloads/crisper.js
diff --git a/chrome/browser/resources/md_downloads/crisper.js b/chrome/browser/resources/md_downloads/crisper.js
index 0677f9144202cc2a4c0b582afd1028661c746aa2..76ba86968342ede51226fff435a0a8400fe58963 100644
--- a/chrome/browser/resources/md_downloads/crisper.js
+++ b/chrome/browser/resources/md_downloads/crisper.js
@@ -10507,10 +10507,17 @@ var CrSearchFieldBehavior = {
},
/**
+ * @abstract
+ * @return {!HTMLInputElement} The input field element the behavior should
+ * use.
+ */
+ getSearchInput: function() {},
+
+ /**
* @return {string} The value of the search field.
*/
getValue: function() {
- return this.$.searchInput.value;
+ return this.getSearchInput().value;
},
/**
@@ -10520,7 +10527,7 @@ var CrSearchFieldBehavior = {
setValue: function(value) {
// Use bindValue when setting the input value so that changes propagate
// correctly.
- this.$.searchInput.bindValue = value;
+ this.getSearchInput().bindValue = value;
this.onValueChanged_(value);
},
@@ -10531,7 +10538,7 @@ var CrSearchFieldBehavior = {
/** @private */
focus_: function() {
- this.$.searchInput.focus();
+ this.getSearchInput().focus();
},
onSearchTermSearch: function() {
@@ -10565,12 +10572,7 @@ var CrSearchFieldBehavior = {
}
this.setValue('');
- this.$.searchInput.blur();
- },
-
- /** @return {boolean} */
- isSearchFocused: function() {
- return this.$.searchTerm.focused;
+ this.getSearchInput().blur();
}
};
(function() {
@@ -11347,10 +11349,15 @@ var SearchField = Polymer({
value_: String,
},
+ /** @return {!HTMLInputElement} */
+ getSearchInput: function() {
+ return this.$.searchInput;
+ },
+
/** @private */
clearSearch_: function() {
this.setValue('');
- this.$.searchInput.focus();
+ this.getSearchInput().focus();
},
/** @private */
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_search_field/cr_search_field.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698