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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js

Issue 2764003002: DevTools: Do not apply first suggestion in the classes pane on enter (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 Elements.ClassesPaneWidget = class extends UI.Widget { 7 Elements.ClassesPaneWidget = class extends UI.Widget {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this.element.className = 'styles-element-classes-pane'; 10 this.element.className = 'styles-element-classes-pane';
(...skipping 23 matching lines...) Expand all
34 var text = event.target.textContent; 34 var text = event.target.textContent;
35 if (isEscKey(event)) { 35 if (isEscKey(event)) {
36 event.target.textContent = ''; 36 event.target.textContent = '';
37 if (!text.isWhitespace()) 37 if (!text.isWhitespace())
38 event.consume(true); 38 event.consume(true);
39 return; 39 return;
40 } 40 }
41 41
42 if (!isEnterKey(event)) 42 if (!isEnterKey(event))
43 return; 43 return;
44 if (this._prompt.acceptAutoComplete()) {
45 event.consume(true);
46 return;
47 }
44 var node = UI.context.flavor(SDK.DOMNode); 48 var node = UI.context.flavor(SDK.DOMNode);
45 if (!node) 49 if (!node)
46 return; 50 return;
47 51
48 this._prompt.clearAutocomplete(); 52 this._prompt.clearAutocomplete();
49 event.target.textContent = ''; 53 event.target.textContent = '';
50 var classNames = text.split(/[.,\s]/); 54 var classNames = text.split(/[.,\s]/);
51 for (var className of classNames) { 55 for (var className of classNames) {
52 var className = className.trim(); 56 var className = className.trim();
53 if (!className.length) 57 if (!className.length)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id()) 259 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id())
256 this._classNamesPromise = this._getClassNames(selectedNode); 260 this._classNamesPromise = this._getClassNames(selectedNode);
257 261
258 return this._classNamesPromise.then(completions => { 262 return this._classNamesPromise.then(completions => {
259 if (prefix[0] === '.') 263 if (prefix[0] === '.')
260 completions = completions.map(value => '.' + value); 264 completions = completions.map(value => '.' + value);
261 return completions.filter(value => value.startsWith(prefix)).map(completio n => ({text: completion})); 265 return completions.filter(value => value.startsWith(prefix)).map(completio n => ({text: completion}));
262 }); 266 });
263 } 267 }
264 }; 268 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698