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

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

Issue 2776263006: [DevTools] Migrate checkbox label to a proper web component (Closed)
Patch Set: Created 3 years, 8 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 this._input.disabled = !node; 93 this._input.disabled = !node;
94 94
95 if (!node) 95 if (!node)
96 return; 96 return;
97 97
98 var classes = this._nodeClasses(node); 98 var classes = this._nodeClasses(node);
99 var keys = classes.keysArray(); 99 var keys = classes.keysArray();
100 keys.sort(String.caseInsensetiveComparator); 100 keys.sort(String.caseInsensetiveComparator);
101 for (var i = 0; i < keys.length; ++i) { 101 for (var i = 0; i < keys.length; ++i) {
102 var className = keys[i]; 102 var className = keys[i];
103 var label = UI.createCheckboxLabel(className, classes.get(className)); 103 var label = UI.CheckboxLabel.create(className, classes.get(className));
104 label.visualizeFocus = true; 104 label.visualizeFocus = true;
105 label.classList.add('monospace'); 105 label.classList.add('monospace');
106 label.checkboxElement.addEventListener('click', this._onClick.bind(this, c lassName), false); 106 label.checkboxElement.addEventListener('click', this._onClick.bind(this, c lassName), false);
107 this._classesContainer.appendChild(label); 107 this._classesContainer.appendChild(label);
108 } 108 }
109 } 109 }
110 110
111 /** 111 /**
112 * @param {string} className 112 * @param {string} className
113 * @param {!Event} event 113 * @param {!Event} event
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id()) 259 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id())
260 this._classNamesPromise = this._getClassNames(selectedNode); 260 this._classNamesPromise = this._getClassNames(selectedNode);
261 261
262 return this._classNamesPromise.then(completions => { 262 return this._classNamesPromise.then(completions => {
263 if (prefix[0] === '.') 263 if (prefix[0] === '.')
264 completions = completions.map(value => '.' + value); 264 completions = completions.map(value => '.' + value);
265 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}));
266 }); 266 });
267 } 267 }
268 }; 268 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698