Skip to content

Commit 6b7f2df

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
Remove textElement member from the CheckboxLabel
This is the first step to replacing custom <dt-checkbox> component with a simple <label> Bug: 407751147 Change-Id: I028de14edf56e75935c0086a6431c451671fabe8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6439366 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Danil Somsikov <dsv@chromium.org>
1 parent 83d3b04 commit 6b7f2df

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox implements UI.Cont
231231
}
232232

233233
label.classList.add('cursor-auto');
234-
label.textElement.addEventListener('dblclick', this.labelClicked.bind(this, item), false);
234+
label.addEventListener('dblclick', this.labelClicked.bind(this, item), false);
235235
this.#breakpointElements.set(item, listItemElement);
236236
listItemElement.setAttribute('jslog', `${VisualLogging.item().track({
237237
click: true,

front_end/panels/elements/ElementStatePaneWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class ElementStatePaneWidget extends UI.Widget.Widget {
135135
enable: Host.UserMetrics.Action.ToggleEmulateFocusedPageFromStylesPaneOn,
136136
disable: Host.UserMetrics.Action.ToggleEmulateFocusedPageFromStylesPaneOff,
137137
});
138-
UI.Tooltip.Tooltip.install(label.textElement, i18nString(UIStrings.emulatesAFocusedPage));
138+
UI.Tooltip.Tooltip.install(label, i18nString(UIStrings.emulatesAFocusedPage));
139139

140140
const learnMoreButton = new Buttons.Button.Button();
141141
learnMoreButton.data = {

front_end/ui/legacy/Toolbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ class ToolbarInputElement extends HTMLElement {
905905
return [...options].map((({value}) => value)).filter(value => value.startsWith(prefix)).map(text => ({text}));
906906
}
907907

908-
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void {
908+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void {
909909
if (name === 'value') {
910910
if (this.item && this.item.value() !== newValue) {
911911
this.item.setValue(newValue, true);
@@ -1320,7 +1320,7 @@ export class ToolbarCheckbox extends ToolbarItem<void> {
13201320
if (tooltip) {
13211321
// install on the checkbox
13221322
Tooltip.install(this.inputElement, tooltip);
1323-
Tooltip.install((this.element as CheckboxLabel).textElement, tooltip);
1323+
Tooltip.install(this.element, tooltip);
13241324
}
13251325
if (listener) {
13261326
this.inputElement.addEventListener('click', listener, false);

front_end/ui/legacy/UIUtils.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,21 +1305,21 @@ export function setTitle(element: HTMLElement, title: string): void {
13051305
}
13061306

13071307
export class CheckboxLabel extends HTMLElement {
1308-
private readonly shadowRootInternal!: DocumentFragment;
1308+
readonly #shadowRoot!: DocumentFragment;
13091309
checkboxElement!: HTMLInputElement;
1310-
textElement!: HTMLElement;
1310+
#textElement!: HTMLElement;
13111311

13121312
constructor() {
13131313
super();
13141314
CheckboxLabel.lastId = CheckboxLabel.lastId + 1;
13151315
const id = 'ui-checkbox-label' + CheckboxLabel.lastId;
1316-
this.shadowRootInternal = createShadowRootWithCoreStyles(this, {cssFile: checkboxTextLabelStyles});
1317-
this.checkboxElement = this.shadowRootInternal.createChild('input');
1316+
this.#shadowRoot = createShadowRootWithCoreStyles(this, {cssFile: checkboxTextLabelStyles});
1317+
this.checkboxElement = this.#shadowRoot.createChild('input');
13181318
this.checkboxElement.type = 'checkbox';
13191319
this.checkboxElement.setAttribute('id', id);
1320-
this.textElement = this.shadowRootInternal.createChild('label', 'dt-checkbox-text');
1321-
this.textElement.setAttribute('for', id);
1322-
this.shadowRootInternal.createChild('slot');
1320+
this.#textElement = this.#shadowRoot.createChild('label', 'dt-checkbox-text');
1321+
this.#textElement.setAttribute('for', id);
1322+
this.#shadowRoot.createChild('slot');
13231323
}
13241324

13251325
static create(
@@ -1332,10 +1332,10 @@ export class CheckboxLabel extends HTMLElement {
13321332
'jslog', `${VisualLogging.toggle().track({change: true}).context(jslogContext)}`);
13331333
}
13341334
if (title !== undefined) {
1335-
element.textElement.textContent = title;
1335+
element.#textElement.textContent = title;
13361336
element.checkboxElement.title = title;
13371337
if (subtitle !== undefined) {
1338-
element.textElement.createChild('div', 'dt-checkbox-subtitle').textContent = subtitle;
1338+
element.#textElement.createChild('div', 'dt-checkbox-subtitle').textContent = subtitle;
13391339
}
13401340
}
13411341
element.checkboxElement.classList.toggle('small', small);

0 commit comments

Comments
 (0)