OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 setTitle(title) { | 193 setTitle(title) { |
194 this._title = title; | 194 this._title = title; |
195 if (this._proxyElement) | 195 if (this._proxyElement) |
196 this._proxyElement.title = title; | 196 this._proxyElement.title = title; |
197 } | 197 } |
198 | 198 |
199 /** | 199 /** |
200 * @param {string} placeholder | 200 * @param {string} placeholder |
201 */ | 201 */ |
202 setPlaceholder(placeholder) { | 202 setPlaceholder(placeholder) { |
203 this._element.setAttribute('data-placeholder', placeholder); | 203 if (placeholder) |
| 204 this._element.setAttribute('data-placeholder', placeholder); |
| 205 else |
| 206 this._element.removeAttribute('data-placeholder'); |
204 } | 207 } |
205 | 208 |
206 _removeFromElement() { | 209 _removeFromElement() { |
207 this.clearAutocomplete(); | 210 this.clearAutocomplete(); |
208 this._element.removeEventListener('keydown', this._boundOnKeyDown, false); | 211 this._element.removeEventListener('keydown', this._boundOnKeyDown, false); |
209 this._element.removeEventListener('input', this._boundOnInput, false); | 212 this._element.removeEventListener('input', this._boundOnInput, false); |
210 this._element.removeEventListener('selectstart', this._boundClearAutocomplet
e, false); | 213 this._element.removeEventListener('selectstart', this._boundClearAutocomplet
e, false); |
211 this._element.removeEventListener('blur', this._boundClearAutocomplete, fals
e); | 214 this._element.removeEventListener('blur', this._boundClearAutocomplete, fals
e); |
212 this._element.ownerDocument.defaultView.removeEventListener('resize', this._
boundClearAutocomplete, false); | 215 this._element.ownerDocument.defaultView.removeEventListener('resize', this._
boundClearAutocomplete, false); |
213 if (this._isEditing) | 216 if (this._isEditing) |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 } | 638 } |
636 }; | 639 }; |
637 | 640 |
638 UI.TextPrompt.DefaultAutocompletionTimeout = 250; | 641 UI.TextPrompt.DefaultAutocompletionTimeout = 250; |
639 | 642 |
640 /** @enum {symbol} */ | 643 /** @enum {symbol} */ |
641 UI.TextPrompt.Events = { | 644 UI.TextPrompt.Events = { |
642 ItemApplied: Symbol('text-prompt-item-applied'), | 645 ItemApplied: Symbol('text-prompt-item-applied'), |
643 ItemAccepted: Symbol('text-prompt-item-accepted') | 646 ItemAccepted: Symbol('text-prompt-item-accepted') |
644 }; | 647 }; |
OLD | NEW |