Skip to content

Commit 2638f1b

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Use default slot for the adorner content
This makes it easier to specify the content in the template Bug: 301364727 Change-Id: I8b16c253eb222d28062b734cab196b24ae5ed0fa Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6388135 Reviewed-by: Philip Pfaffe <[email protected]> Commit-Queue: Danil Somsikov <[email protected]>
1 parent bc6940d commit 2638f1b

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

front_end/panels/application/components/OriginTrialTreeView.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function extractBadgeTextFromTreeNode(node: HTMLLIElement): string[] {
135135
if (adornerElement === null) {
136136
return '';
137137
}
138-
const contentElement = adornerElement.querySelector('[slot="content"]');
138+
const contentElement = adornerElement.firstElementChild;
139139
assert.isNotNull(contentElement);
140140
if (contentElement === null) {
141141
return '';

front_end/panels/autofill/AutofillView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,11 @@ export class AutofillView extends LegacyWrapper.LegacyWrapper.WrappableComponent
367367
${field.autofillType}
368368
${field.fillingStrategy === FillingStrategy.AutocompleteAttribute ?
369369
html`<devtools-adorner title=${i18nString(UIStrings.autocompleteAttribute)} .data=${{name: field.fillingStrategy}}>
370-
<span slot="content">${i18nString(UIStrings.attr)}</span>
370+
<span>${i18nString(UIStrings.attr)}</span>
371371
</devtools-adorner>` :
372372
field.fillingStrategy === FillingStrategy.AutofillInferred ?
373373
html`<devtools-adorner title=${i18nString(UIStrings.inferredByHeuristics)} .data=${{name: field.fillingStrategy}}>
374-
<span slot="content">${i18nString(UIStrings.heur)}</span>
374+
<span>${i18nString(UIStrings.heur)}</span>
375375
</devtools-adorner>` :
376376
Lit.nothing}
377377
</td>

front_end/panels/network/NetworkLogView.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ function getCountAdorner(filterBar: UI.FilterBar.FilterBar): HTMLElement|null {
10111011

10121012
function getMoreFiltersActiveCount(filterBar: UI.FilterBar.FilterBar): string {
10131013
const countAdorner = getCountAdorner(filterBar);
1014-
const count = countAdorner?.querySelector('[slot="content"]')?.textContent ?? '';
1014+
const count = countAdorner?.firstChild?.textContent ?? '';
10151015
return count;
10161016
}
10171017

front_end/ui/components/adorners/Adorner.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('Adorner', () => {
126126
name: 'foo',
127127
};
128128

129-
const slottedChildren = adorner.querySelectorAll('[slot="content"]');
129+
const slottedChildren = adorner.children;
130130
assert.lengthOf(slottedChildren, 1, 'adorner light dom should only have one child with [slot="content"]');
131131
assert.strictEqual(
132132
slottedChildren[0].textContent, 'content 3', 'adorner content slot should have the most recent content');

front_end/ui/components/adorners/Adorner.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class Adorner extends HTMLElement {
2828
this.name = data.name;
2929
this.#jslogContext = data.jslogContext;
3030
if (data.content) {
31-
data.content.slot = 'content';
3231
this.#content?.remove();
3332
this.append(data.content);
3433
this.#content = data.content;
@@ -120,7 +119,7 @@ export class Adorner extends HTMLElement {
120119
}
121120

122121
#render(): void {
123-
render(html`<style>${adornerStyles.cssText}</style><slot name="content"></slot>`, this.#shadow, {host: this});
122+
render(html`<style>${adornerStyles.cssText}</style><slot></slot>`, this.#shadow, {host: this});
124123
}
125124
}
126125

0 commit comments

Comments
 (0)