豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit e642bfe

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
Remove the last of Fragment
Bug: none Change-Id: Iee6f8040612b5eb64591db75cb21bb2da88afb02 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7647112 Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org> Reviewed-by: Danil Somsikov <dsv@chromium.org>
1 parent fae220f commit e642bfe

File tree

5 files changed

+52
-25
lines changed

5 files changed

+52
-25
lines changed

front_end/panels/elements/StylePropertyTreeElement.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,11 +1575,17 @@ export class GridTemplateRenderer extends rendererBase(SDK.CSSPropertyParserMatc
15751575

15761576
const indent = Common.Settings.Settings.instance().moduleSetting('text-editor-indent').get();
15771577
const container = document.createDocumentFragment();
1578-
for (const line of match.lines) {
1579-
const value = Renderer.render(line, context);
1580-
const lineBreak = UI.Fragment.html`<br /><span class='styles-clipboard-only'>${indent.repeat(2)}</span>`;
1581-
container.append(lineBreak, ...value.nodes);
1582-
}
1578+
1579+
const template = html`
1580+
${match.lines.map(line => {
1581+
const lines = Renderer.render(line, context).nodes;
1582+
return html`
1583+
<span class='styles-clipboard-only'>${indent.repeat(2)}</span>
1584+
${lines}`;
1585+
})}
1586+
`;
1587+
1588+
render(template, container);
15831589
return [container];
15841590
}
15851591
}

front_end/panels/issues/AffectedPermissionElementsView.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import * as i18n from '../../core/i18n/i18n.js';
66
import type * as Platform from '../../core/platform/platform.js';
77
import type * as IssuesManager from '../../models/issues_manager/issues_manager.js';
8-
import * as UI from '../../ui/legacy/legacy.js';
8+
import {html, render} from '../../ui/lit/lit.js';
99

1010
import {AffectedElementsView} from './AffectedElementsView.js';
1111

@@ -31,16 +31,19 @@ export class AffectedPermissionElementsView extends AffectedElementsView {
3131
async #appendAffectedElements(issues: Iterable<IssuesManager.PermissionElementIssue.PermissionElementIssue>):
3232
Promise<void> {
3333
let count = 0;
34+
// clang-format off
35+
const templates = [];
3436
for (const issue of issues) {
3537
for (const element of issue.elements()) {
36-
const rowElement = UI.Fragment.html`
37-
<tr>
38-
${await this.createElementCell(element, this.issue.getCategory())}
39-
</tr>`;
40-
this.affectedResources.appendChild(rowElement);
4138
count++;
39+
templates.push(html`<tr>
40+
${await this.createElementCell(element, this.issue.getCategory())}
41+
</tr>`);
4242
}
4343
}
44+
// clang-format on
45+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
46+
render(html`${templates}`, this.affectedResources);
4447
this.updateAffectedResourceCount(count);
4548
}
4649
}

front_end/panels/profiler/HeapSnapshotGridNodes.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,15 @@ export class HeapSnapshotObjectNode extends HeapSnapshotGenericObjectNode {
906906
if (this.cycledWithAncestorGridNode) {
907907
div.classList.add('cycled-ancestor-node');
908908
}
909-
div.prepend(UI.Fragment.html`<span class="property-name ${nameClass}">${name}</span>
910-
<span class="grayed">${this.edgeNodeSeparator()}</span>`);
909+
const property = document.createElement('span');
910+
property.classList.add('property-name', nameClass);
911+
property.textContent = name;
912+
913+
const separator = document.createElement('span');
914+
separator.classList.add('grayed');
915+
separator.textContent = this.edgeNodeSeparator();
916+
917+
div.prepend(property, separator);
911918
}
912919

913920
edgeNodeSeparator(): string {
@@ -1170,7 +1177,8 @@ export class HeapSnapshotConstructorNode extends HeapSnapshotGridNode {
11701177
override createCell(columnId: string): HTMLElement {
11711178
const cell = columnId === 'object' ? super.createCell(columnId) : this.createValueCell(columnId);
11721179
if (columnId === 'object' && this.count > 1) {
1173-
cell.appendChild(UI.Fragment.html`<span class="objects-count">×${this.data.count}</span>`);
1180+
const template = html`<span class="objects-count">×${this.data.count}</span>`;
1181+
render(template, cell);
11741182
}
11751183
return cell;
11761184
}

front_end/panels/timeline/TimelineUIUtils.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
*/
3636

37+
import '../../ui/kit/kit.js';
38+
3739
import * as Common from '../../core/common/common.js';
3840
import * as i18n from '../../core/i18n/i18n.js';
3941
import * as Platform from '../../core/platform/platform.js';
@@ -50,13 +52,13 @@ import * as CodeHighlighter from '../../ui/components/code_highlighter/code_high
5052
// eslint-disable-next-line @devtools/es-modules-import
5153
import codeHighlighterStyles from '../../ui/components/code_highlighter/codeHighlighter.css.js';
5254
import * as uiI18n from '../../ui/i18n/i18n.js';
53-
import {Link} from '../../ui/kit/kit.js';
5455
import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
5556
// eslint-disable-next-line @devtools/es-modules-import
5657
import imagePreviewStyles from '../../ui/legacy/components/utils/imagePreview.css.js';
5758
import * as LegacyComponents from '../../ui/legacy/components/utils/utils.js';
5859
import * as UI from '../../ui/legacy/legacy.js';
5960
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
61+
import {html, render} from '../../ui/lit/lit.js';
6062
import * as PanelsCommon from '../common/common.js';
6163

6264
import {getDurationString} from './AppenderUtils.js';
@@ -833,9 +835,10 @@ export class TimelineUIUtils {
833835
break;
834836
}
835837

836-
const html = UI.Fragment.html`<div>${
837-
Link.create(link, i18nString(UIStrings.learnMore), undefined, 'learn-more')} about ${name}.</div>`;
838-
return html as HTMLElement;
838+
const div = document.createElement('div');
839+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
840+
render(html`<devtools-link href=${link}>${i18nString(UIStrings.learnMore)}</devtools-link> about ${name}.`, div);
841+
return div;
839842
}
840843

841844
static buildConsumeCacheDetails(

front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,18 +636,25 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
636636
}
637637

638638
static createNameElement(name: string|null, isPrivate?: boolean): Element {
639+
const element = document.createElement('span');
640+
element.classList.add('name');
639641
if (name === null) {
640-
return UI.Fragment.html`<span class="name"></span>`;
642+
return element;
641643
}
642644
if (/^\s|\s$|^$|\n/.test(name)) {
643-
return UI.Fragment.html`<span class="name">"${name.replace(/\n/g, '\u21B5')}"</span>`;
645+
element.textContent = `"${name.replace(/\n/g, '\u21B5')}"`;
646+
return element;
644647
}
645648
if (isPrivate) {
646-
return UI.Fragment.html`<span class="name">
647-
<span class="private-property-hash">${name[0]}</span>${name.substring(1)}
648-
</span>`;
649-
}
650-
return UI.Fragment.html`<span class="name">${name}</span>`;
649+
const privatePropertyHash = document.createElement('span');
650+
privatePropertyHash.classList.add('private-property-hash');
651+
privatePropertyHash.textContent = name[0];
652+
element.appendChild(privatePropertyHash);
653+
element.appendChild(document.createTextNode(name.substring(1)));
654+
return element;
655+
}
656+
element.textContent = name;
657+
return element;
651658
}
652659

653660
static valueElementForFunctionDescription(

0 commit comments

Comments
 (0)