Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // TODO(tsergeant): Add tests for cr-toolbar-search-field. | |
| 6 Polymer({ | |
| 7 is: 'cr-toolbar-search-field', | |
| 8 | |
| 9 behaviors: [CrSearchFieldBehavior], | |
| 10 | |
| 11 properties: { | |
| 12 narrow: { | |
| 13 type: Boolean, | |
| 14 reflectToAttribute: true, | |
| 15 }, | |
|
dpapad
2016/05/26 00:42:52
Nit: Blank lines between polymer properties.
tsergeant
2016/05/26 01:34:52
Done.
| |
| 16 // Prompt text to display in the search field. | |
| 17 label: String, | |
| 18 // Tooltip to display on the clear search button. | |
| 19 clearLabel: String, | |
| 20 }, | |
| 21 | |
| 22 listeners: { | |
| 23 'tap': 'showSearch_', | |
| 24 'clearSearch.tap': 'hideSearch_', | |
| 25 'searchInput.blur': 'onInputBlur_' | |
|
dpapad
2016/05/26 00:42:52
This listener is already registered in the HTML te
tsergeant
2016/05/26 01:34:52
Done (and I moved the one above it back to HTML fo
| |
| 26 }, | |
| 27 | |
| 28 /** @private */ | |
| 29 onInputBlur_: function() { | |
| 30 if (!this.hasSearchText) | |
| 31 this.showingSearch = false; | |
| 32 }, | |
| 33 | |
| 34 /** | |
| 35 * @param {Event} e | |
| 36 * @private | |
| 37 */ | |
| 38 showSearch_: function(e) { | |
| 39 if (e.target != this.$.clearSearch) | |
| 40 this.showingSearch = true; | |
| 41 }, | |
| 42 | |
| 43 /** | |
| 44 * @param {Event} e | |
| 45 * @private | |
| 46 */ | |
| 47 hideSearch_: function(e) { | |
| 48 this.showingSearch = false; | |
| 49 e.stopPropagation(); | |
| 50 } | |
| 51 }); | |
| OLD | NEW |