| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Helper functions for implementing an incremental search field. See | 6 * Helper functions for implementing an incremental search field. See |
| 7 * <settings-subpage-search> for a simple implementation. | 7 * <settings-subpage-search> for a simple implementation. |
| 8 * @polymerBehavior | 8 * @polymerBehavior |
| 9 */ | 9 */ |
| 10 var CrSearchFieldBehavior = { | 10 var CrSearchFieldBehavior = { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 /** | 29 /** |
| 30 * @abstract | 30 * @abstract |
| 31 * @return {!HTMLInputElement} The input field element the behavior should | 31 * @return {!HTMLInputElement} The input field element the behavior should |
| 32 * use. | 32 * use. |
| 33 */ | 33 */ |
| 34 getSearchInput: function() {}, | 34 getSearchInput: function() {}, |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * @return {string} The value of the search field. | 37 * @return {string} The value of the search field. |
| 38 */ | 38 */ |
| 39 getValue: function() { return this.getSearchInput().value; }, | 39 getValue: function() { |
| 40 return this.getSearchInput().value; |
| 41 }, |
| 40 | 42 |
| 41 /** | 43 /** |
| 42 * Sets the value of the search field. | 44 * Sets the value of the search field. |
| 43 * @param {string} value | 45 * @param {string} value |
| 44 * @param {boolean=} opt_noEvent Whether to prevent a 'search-changed' event | 46 * @param {boolean=} opt_noEvent Whether to prevent a 'search-changed' event |
| 45 * firing for this change. | 47 * firing for this change. |
| 46 */ | 48 */ |
| 47 setValue: function(value, opt_noEvent) { | 49 setValue: function(value, opt_noEvent) { |
| 48 var searchInput = this.getSearchInput(); | 50 var searchInput = this.getSearchInput(); |
| 49 searchInput.value = value; | 51 searchInput.value = value; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 65 onValueChanged_: function(newValue, noEvent) { | 67 onValueChanged_: function(newValue, noEvent) { |
| 66 if (newValue == this.lastValue_) | 68 if (newValue == this.lastValue_) |
| 67 return; | 69 return; |
| 68 | 70 |
| 69 this.lastValue_ = newValue; | 71 this.lastValue_ = newValue; |
| 70 | 72 |
| 71 if (!noEvent) | 73 if (!noEvent) |
| 72 this.fire('search-changed', newValue); | 74 this.fire('search-changed', newValue); |
| 73 }, | 75 }, |
| 74 }; | 76 }; |
| OLD | NEW |