| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 UI.HistoryInput = class extends HTMLInputElement { | 7 UI.HistoryInput = class extends HTMLInputElement { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * @return {!UI.HistoryInput} | 13 * @return {!UI.HistoryInput} |
| 14 */ | 14 */ |
| 15 static create() { | 15 static create() { |
| 16 if (!UI.HistoryInput._constructor) | 16 if (!UI.HistoryInput._constructor) |
| 17 UI.HistoryInput._constructor = registerCustomElement('input', 'history-inp
ut', UI.HistoryInput.prototype); | 17 UI.HistoryInput._constructor = UI.registerCustomElement('input', 'history-
input', UI.HistoryInput.prototype); |
| 18 | 18 |
| 19 return /** @type {!UI.HistoryInput} */ (new UI.HistoryInput._constructor()); | 19 return /** @type {!UI.HistoryInput} */ (new UI.HistoryInput._constructor()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * @override | 23 * @override |
| 24 */ | 24 */ |
| 25 createdCallback() { | 25 createdCallback() { |
| 26 this._history = ['']; | 26 this._history = ['']; |
| 27 this._historyPosition = 0; | 27 this._historyPosition = 0; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 _saveToHistory() { | 59 _saveToHistory() { |
| 60 if (this._history.length > 1 && this._history[this._history.length - 2] ===
this.value) | 60 if (this._history.length > 1 && this._history[this._history.length - 2] ===
this.value) |
| 61 return; | 61 return; |
| 62 this._history[this._history.length - 1] = this.value; | 62 this._history[this._history.length - 1] = this.value; |
| 63 this._historyPosition = this._history.length - 1; | 63 this._historyPosition = this._history.length - 1; |
| 64 this._history.push(''); | 64 this._history.push(''); |
| 65 } | 65 } |
| 66 }; | 66 }; |
| OLD | NEW |