chrome-devtools-frontend 1.0.1696961 → 1.0.1697595
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.geminiignore +0 -1
- package/front_end/core/common/Color.ts +5 -2
- package/front_end/core/host/InspectorFrontendHostAPI.ts +16 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +3 -2
- package/front_end/core/host/ResourceLoader.ts +1 -2
- package/front_end/core/platform/api/HostRuntime.ts +1 -0
- package/front_end/core/platform/browser/HostRuntime.ts +4 -0
- package/front_end/core/platform/node/HostRuntime.ts +5 -0
- package/front_end/core/root/Runtime.ts +5 -0
- package/front_end/core/sdk/DOMModel.ts +13 -0
- package/front_end/core/sdk/SourceMapScopeChainEntry.ts +9 -6
- package/front_end/core/sdk/SourceMapScopesInfo.ts +3 -1
- package/front_end/foundation/Universe.ts +8 -0
- package/front_end/generated/InspectorBackendCommands.ts +3 -0
- package/front_end/generated/protocol-mapping.d.ts +19 -0
- package/front_end/generated/protocol-proxy-api.d.ts +15 -0
- package/front_end/generated/protocol.ts +35 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +20 -18
- package/front_end/models/ai_assistance/AiConversation.ts +38 -12
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +13 -4
- package/front_end/models/ai_assistance/tools/CookieUtils.ts +10 -8
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +1 -3
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -8
- package/front_end/models/ai_assistance/tools/GetSourceContent.ts +5 -6
- package/front_end/models/ai_assistance/tools/GetStorageValues.ts +6 -25
- package/front_end/models/ai_assistance/tools/GetStyles.ts +1 -3
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +7 -6
- package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +8 -5
- package/front_end/models/ai_assistance/tools/ListSources.ts +8 -10
- package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +6 -25
- package/front_end/models/ai_assistance/tools/README.md +5 -3
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +1 -2
- package/front_end/models/ai_assistance/tools/Tool.ts +52 -14
- package/front_end/models/change_tracker/ChangeTracker.ts +89 -0
- package/front_end/models/change_tracker/change_tracker.ts +9 -0
- package/front_end/models/issues_manager/MarkdownIssueDescription.ts +2 -2
- package/front_end/models/live-metrics/LiveMetrics.ts +1 -2
- package/front_end/models/trace/ModelImpl.ts +0 -6
- package/front_end/models/trace/Processor.ts +4 -7
- package/front_end/models/trace/helpers/Timing.ts +2 -1
- package/front_end/models/trace/types/Overlays.ts +12 -1
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +67 -19
- package/front_end/panels/application/IndexedDBViews.ts +1 -1
- package/front_end/panels/elements/DOMTreeContextMenu.ts +16 -23
- package/front_end/panels/elements/ElementsTreeElement.ts +286 -59
- package/front_end/panels/elements/ElementsTreeOutline.ts +273 -42
- package/front_end/panels/network/NetworkPanel.ts +137 -52
- package/front_end/panels/network/RequestHeadersView.ts +65 -32
- package/front_end/panels/network/components/RequestHeadersView.css +7 -1
- package/front_end/panels/network/forward/BackendLinking.ts +49 -0
- package/front_end/panels/network/forward/forward.ts +2 -0
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +303 -0
- package/front_end/panels/settings/backendLinkingSettingsTab.css +78 -0
- package/front_end/panels/settings/settings-meta.ts +25 -0
- package/front_end/panels/settings/settings.ts +2 -0
- package/front_end/panels/timeline/README.md +3 -2
- package/front_end/panels/timeline/TimelineFlameChartView.ts +23 -2
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +64 -4
- package/front_end/panels/timeline/timelineFlameChartView.css +47 -0
- package/front_end/panels/whats_new/ReleaseNoteText.ts +8 -8
- package/front_end/panels/whats_new/resources/WNDT.md +6 -6
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +5 -8
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +1 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Coverage.ts +6 -0
- package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +3 -7
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/web-vitals/README.chromium +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +8 -5
- package/front_end/third_party/web-vitals/package/package.json +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +8 -4
- package/front_end/third_party/web-vitals/rebuild.sh +2 -2
- package/front_end/ui/legacy/ContextMenu.ts +19 -0
- package/front_end/ui/legacy/SoftContextMenu.ts +6 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +62 -22
- package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
- package/package.json +5 -4
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
5
6
|
import * as Marked from '../../third_party/marked/marked.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -57,8 +58,7 @@ export interface IssueDescription {
|
|
|
57
58
|
|
|
58
59
|
export async function getFileContent(url: URL): Promise<string> {
|
|
59
60
|
try {
|
|
60
|
-
|
|
61
|
-
return await response.text();
|
|
61
|
+
return await Platform.HostRuntime.HOST_RUNTIME.loadTextFile(url);
|
|
62
62
|
} catch {
|
|
63
63
|
throw new Error(
|
|
64
64
|
`Markdown file ${url.toString()} not found. Make sure it is correctly listed in the relevant BUILD.gn files.`);
|
|
@@ -42,8 +42,7 @@ class InjectedScript {
|
|
|
42
42
|
static async get(): Promise<string> {
|
|
43
43
|
if (!this.#injectedScript) {
|
|
44
44
|
const url = new URL('./web-vitals-injected/web-vitals-injected.generated.js', import.meta.url);
|
|
45
|
-
|
|
46
|
-
this.#injectedScript = await result.text();
|
|
45
|
+
this.#injectedScript = await Platform.HostRuntime.HOST_RUNTIME.loadTextFile(url);
|
|
47
46
|
}
|
|
48
47
|
return this.#injectedScript;
|
|
49
48
|
}
|
|
@@ -232,12 +232,6 @@ export class ModelUpdateEvent extends Event {
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
declare global {
|
|
236
|
-
interface HTMLElementEventMap {
|
|
237
|
-
[ModelUpdateEvent.eventName]: ModelUpdateEvent;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
235
|
export function isModelUpdateDataComplete(eventData: ModelUpdateEventData): eventData is ModelUpdateEventComplete {
|
|
242
236
|
return eventData.type === ModelUpdateType.COMPLETE;
|
|
243
237
|
}
|
|
@@ -19,7 +19,10 @@ const enum Status {
|
|
|
19
19
|
|
|
20
20
|
export class TraceParseProgressEvent extends Event {
|
|
21
21
|
static readonly eventName = 'traceparseprogress';
|
|
22
|
-
constructor(
|
|
22
|
+
constructor(
|
|
23
|
+
public data: Model.TraceParseEventProgressData,
|
|
24
|
+
init: ConstructorParameters<typeof Event>[1] = {bubbles: true},
|
|
25
|
+
) {
|
|
23
26
|
super(TraceParseProgressEvent.eventName, init);
|
|
24
27
|
}
|
|
25
28
|
}
|
|
@@ -44,12 +47,6 @@ function calculateProgress(value: number, phase: ProgressPhase): number {
|
|
|
44
47
|
return value * phase;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
declare global {
|
|
48
|
-
interface HTMLElementEventMap {
|
|
49
|
-
[TraceParseProgressEvent.eventName]: TraceParseProgressEvent;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
50
|
export class TraceProcessor extends EventTarget {
|
|
54
51
|
// We force the Meta handler to be enabled, so the TraceHandlers type here is
|
|
55
52
|
// the model handlers the user passes in and the Meta handler.
|
|
@@ -155,7 +155,8 @@ export function traceWindowFromOverlay(overlay: Types.Overlays.Overlay): Types.T
|
|
|
155
155
|
switch (overlay.type) {
|
|
156
156
|
case 'ENTRY_LABEL':
|
|
157
157
|
case 'ENTRY_OUTLINE':
|
|
158
|
-
case 'ENTRY_SELECTED':
|
|
158
|
+
case 'ENTRY_SELECTED':
|
|
159
|
+
case 'COMMENT_PIN': {
|
|
159
160
|
return traceWindowFromEvent(overlay.entry);
|
|
160
161
|
}
|
|
161
162
|
|
|
@@ -131,8 +131,19 @@ export interface BottomInfoBar {
|
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Represents an active comment pin anchored to a flame chart entry.
|
|
136
|
+
* Links to a CommentThread by ID in CommentManager, rendering a pin icon and
|
|
137
|
+
* outline highlight over the trace event.
|
|
138
|
+
*/
|
|
139
|
+
export interface CommentPin {
|
|
140
|
+
type: 'COMMENT_PIN';
|
|
141
|
+
entry: OverlayEntry;
|
|
142
|
+
commentThreadId: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
134
145
|
/**
|
|
135
146
|
* All supported overlay types.
|
|
136
147
|
*/
|
|
137
148
|
export type Overlay = EntrySelected|EntryOutline|TimeRangeLabel|EntryLabel|EntriesLink|TimespanBreakdown|
|
|
138
|
-
TimestampMarker|CandyStripedTimeRange|TimingsMarker|BottomInfoBar;
|
|
149
|
+
TimestampMarker|CandyStripedTimeRange|TimingsMarker|BottomInfoBar|CommentPin;
|
|
@@ -205,7 +205,28 @@ export function injectedScript(ariaLiveApi: string, jsTriggeredApi: string): voi
|
|
|
205
205
|
let lastRecordedPoliteness: string|null = null;
|
|
206
206
|
let lastRecordedTime = 0;
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
const pendingLiveNodes = new Set<Element>();
|
|
209
|
+
let scheduledFlushId: number|null = null;
|
|
210
|
+
|
|
211
|
+
function scheduleFlush(): void {
|
|
212
|
+
if (scheduledFlushId !== null) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
scheduledFlushId = window.requestAnimationFrame(() => {
|
|
216
|
+
scheduledFlushId = null;
|
|
217
|
+
flushPendingNodes();
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function flushPendingNodes(): void {
|
|
222
|
+
const nodes = Array.from(pendingLiveNodes);
|
|
223
|
+
pendingLiveNodes.clear();
|
|
224
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
225
|
+
processLiveNode(nodes[i]);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Queues an active live region node for deferred visibility checking and emission.
|
|
209
230
|
function recordLiveNode(node: Node|null|undefined): void {
|
|
210
231
|
if (!node || node.nodeType !== Node.ELEMENT_NODE) {
|
|
211
232
|
return;
|
|
@@ -218,6 +239,22 @@ export function injectedScript(ariaLiveApi: string, jsTriggeredApi: string): voi
|
|
|
218
239
|
if (element.getAttribute('aria-hidden') === 'true') {
|
|
219
240
|
return;
|
|
220
241
|
}
|
|
242
|
+
pendingLiveNodes.add(element);
|
|
243
|
+
scheduleFlush();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Emits an announcement payload for an active live region node via the CDP binding after layout.
|
|
247
|
+
function processLiveNode(element: Element): void {
|
|
248
|
+
if ('isConnected' in element && !element.isConnected) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const politeness = derivePoliteness(element);
|
|
252
|
+
if (politeness === 'off') {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (element.getAttribute('aria-hidden') === 'true') {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
221
258
|
if (!checkVisibility(element)) {
|
|
222
259
|
return;
|
|
223
260
|
}
|
|
@@ -293,18 +330,14 @@ export function injectedScript(ariaLiveApi: string, jsTriggeredApi: string): voi
|
|
|
293
330
|
for (const node of mutation.addedNodes) {
|
|
294
331
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
295
332
|
const el = node as Element;
|
|
296
|
-
if (el.shadowRoot) {
|
|
297
|
-
observeSubtree(el.shadowRoot);
|
|
298
|
-
scanAndObserveShadowRoots(el.shadowRoot);
|
|
299
|
-
}
|
|
300
333
|
scanAndObserveShadowRoots(el);
|
|
301
334
|
|
|
302
|
-
if (el.matches
|
|
335
|
+
if (el.matches(selector)) {
|
|
303
336
|
recordLiveNode(el);
|
|
304
337
|
}
|
|
305
|
-
const children = el.querySelectorAll
|
|
306
|
-
for (
|
|
307
|
-
recordLiveNode(
|
|
338
|
+
const children = el.querySelectorAll(selector);
|
|
339
|
+
for (let i = 0; i < children.length; i++) {
|
|
340
|
+
recordLiveNode(children[i]);
|
|
308
341
|
}
|
|
309
342
|
}
|
|
310
343
|
}
|
|
@@ -348,20 +381,29 @@ export function injectedScript(ariaLiveApi: string, jsTriggeredApi: string): voi
|
|
|
348
381
|
}
|
|
349
382
|
}
|
|
350
383
|
|
|
351
|
-
function scanAndObserveShadowRoots(
|
|
352
|
-
if (!
|
|
384
|
+
function scanAndObserveShadowRoots(root: Element|ShadowRoot|null|undefined): void {
|
|
385
|
+
if (!root) {
|
|
353
386
|
return;
|
|
354
387
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
388
|
+
const queue: Array<Element|ShadowRoot> = [root];
|
|
389
|
+
while (queue.length > 0) {
|
|
390
|
+
const current = queue.pop();
|
|
391
|
+
if (!current) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
const el = current as Element;
|
|
395
|
+
if (el.shadowRoot && !observedRoots.has(el.shadowRoot)) {
|
|
358
396
|
observeSubtree(el.shadowRoot);
|
|
359
|
-
|
|
397
|
+
queue.push(el.shadowRoot);
|
|
398
|
+
}
|
|
399
|
+
const descendants = current.querySelectorAll('*');
|
|
400
|
+
for (let i = 0; i < descendants.length; i++) {
|
|
401
|
+
const descendant = descendants[i];
|
|
402
|
+
if (descendant.shadowRoot && !observedRoots.has(descendant.shadowRoot)) {
|
|
403
|
+
observeSubtree(descendant.shadowRoot);
|
|
404
|
+
queue.push(descendant.shadowRoot);
|
|
405
|
+
}
|
|
360
406
|
}
|
|
361
|
-
}
|
|
362
|
-
const children = (node as Element).children || [];
|
|
363
|
-
for (let i = 0; i < children.length; i++) {
|
|
364
|
-
scanAndObserveShadowRoots(children[i]);
|
|
365
407
|
}
|
|
366
408
|
}
|
|
367
409
|
|
|
@@ -380,6 +422,7 @@ export function injectedScript(ariaLiveApi: string, jsTriggeredApi: string): voi
|
|
|
380
422
|
const shadow = origAttachShadow.apply(this, [init]);
|
|
381
423
|
if (init && init.mode === 'open') {
|
|
382
424
|
observeSubtree(shadow);
|
|
425
|
+
scanAndObserveShadowRoots(shadow);
|
|
383
426
|
}
|
|
384
427
|
return shadow;
|
|
385
428
|
};
|
|
@@ -392,6 +435,11 @@ export function injectedScript(ariaLiveApi: string, jsTriggeredApi: string): voi
|
|
|
392
435
|
// Registers cleanup function invoked during recording teardown.
|
|
393
436
|
window.__announcementsRecorderBinding_cleanup = function(): void {
|
|
394
437
|
observer.disconnect();
|
|
438
|
+
if (scheduledFlushId !== null) {
|
|
439
|
+
window.cancelAnimationFrame(scheduledFlushId);
|
|
440
|
+
scheduledFlushId = null;
|
|
441
|
+
}
|
|
442
|
+
pendingLiveNodes.clear();
|
|
395
443
|
if (originalElementAriaNotify) {
|
|
396
444
|
try {
|
|
397
445
|
(Element.prototype as unknown as Record<string, unknown>)['ariaNotify'] = originalElementAriaNotify;
|
|
@@ -298,7 +298,7 @@ const renderDataGrid = (input: IndexedDBDataViewInput): LitTemplate => {
|
|
|
298
298
|
${input.isIndex ? html`<th id="primary-key" weight="2">${renderKeyColumnHeader(i18nString(UIStrings.primaryKey), input.objectStore.keyPath)}</th>` : nothing}
|
|
299
299
|
<th id="value" weight="8">${i18nString(UIStrings.valueString)}</th>
|
|
300
300
|
</tr>
|
|
301
|
-
${repeat(input.entries,
|
|
301
|
+
${repeat(input.entries, entry => entry, (entry, index) => {
|
|
302
302
|
return html`
|
|
303
303
|
<tr ?selected=${index + input.skipCount === input.selectedRowNumber}
|
|
304
304
|
class="data-grid-data-row"
|
|
@@ -10,7 +10,7 @@ import * as Emulation from '../emulation/emulation.js';
|
|
|
10
10
|
|
|
11
11
|
import {canGetJSPath} from './DOMPath.js';
|
|
12
12
|
import {ElementsPanel} from './ElementsPanel.js';
|
|
13
|
-
import {ElementsTreeElement
|
|
13
|
+
import {ElementsTreeElement} from './ElementsTreeElement.js';
|
|
14
14
|
import type {DOMTreeWidget} from './ElementsTreeOutline.js';
|
|
15
15
|
|
|
16
16
|
const UIStrings = {
|
|
@@ -198,10 +198,9 @@ export async function populateNodeContextMenu(
|
|
|
198
198
|
contextMenu: UI.ContextMenu.ContextMenu,
|
|
199
199
|
domTreeWidget: DOMTreeWidget,
|
|
200
200
|
domNode: SDK.DOMModel.DOMNode,
|
|
201
|
-
targetWidget?: ElementsTreeWidget,
|
|
202
201
|
): Promise<void> {
|
|
203
202
|
const isEditable = !domNode.isShadowRoot() && !domNode.ancestorUserAgentShadowRoot();
|
|
204
|
-
if (isEditable
|
|
203
|
+
if (isEditable) {
|
|
205
204
|
contextMenu.editSection().appendItem(i18nString(UIStrings.editAsHtml),
|
|
206
205
|
() => domTreeWidget.toggleEditAsHTML(domNode),
|
|
207
206
|
{jslogContext: 'elements.edit-as-html'});
|
|
@@ -448,7 +447,6 @@ export async function showContextMenu(
|
|
|
448
447
|
domTreeWidget: DOMTreeWidget,
|
|
449
448
|
domNode: SDK.DOMModel.DOMNode,
|
|
450
449
|
event: Event,
|
|
451
|
-
targetWidget?: ElementsTreeWidget,
|
|
452
450
|
): Promise<UI.ContextMenu.ContextMenu|undefined> {
|
|
453
451
|
if (UI.UIUtils.isEditing()) {
|
|
454
452
|
return;
|
|
@@ -482,29 +480,25 @@ export async function showContextMenu(
|
|
|
482
480
|
() => void domNode.saveNodeToTempVariable(),
|
|
483
481
|
{jslogContext: 'store-as-global-variable'});
|
|
484
482
|
if (textNode) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
{jslogContext: 'edit-text'});
|
|
489
|
-
}
|
|
490
|
-
await populateNodeContextMenu(contextMenu, domTreeWidget, domNode, targetWidget);
|
|
483
|
+
contextMenu.editSection().appendItem(
|
|
484
|
+
i18nString(UIStrings.editText), () => domTreeWidget.startEditingTextNode(domNode), {jslogContext: 'edit-text'});
|
|
485
|
+
await populateNodeContextMenu(contextMenu, domTreeWidget, domNode);
|
|
491
486
|
} else if (isTag) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
if (startTagWidget) {
|
|
495
|
-
contextMenu.editSection().appendItem(i18nString(UIStrings.addAttribute), () => startTagWidget.addNewAttribute(),
|
|
496
|
-
{jslogContext: 'add-attribute'});
|
|
497
|
-
}
|
|
487
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.addAttribute),
|
|
488
|
+
() => domTreeWidget.addNewAttribute(domNode), {jslogContext: 'add-attribute'});
|
|
498
489
|
|
|
499
490
|
const target = (event.composedPath()[0] || event.target) as Element;
|
|
500
491
|
const attribute = target.enclosingNodeOrSelfWithClass?.('webkit-html-attribute');
|
|
501
492
|
const newAttribute = target.enclosingNodeOrSelfWithClass?.('add-attribute');
|
|
502
493
|
if (attribute && !newAttribute) {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
494
|
+
const attributeName = attribute.querySelector('.webkit-html-attribute-name')?.textContent?.trim();
|
|
495
|
+
if (attributeName) {
|
|
496
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.editAttribute),
|
|
497
|
+
() => domTreeWidget.startEditing(domNode, attributeName),
|
|
498
|
+
{jslogContext: 'edit-attribute'});
|
|
499
|
+
}
|
|
506
500
|
}
|
|
507
|
-
await populateNodeContextMenu(contextMenu, domTreeWidget, domNode
|
|
501
|
+
await populateNodeContextMenu(contextMenu, domTreeWidget, domNode);
|
|
508
502
|
ElementsTreeElement.populateForcedPseudoStateItems(contextMenu, domNode);
|
|
509
503
|
contextMenu.viewSection().appendItem(i18nString(UIStrings.scrollIntoView), () => domNode.scrollIntoView(),
|
|
510
504
|
{jslogContext: 'scroll-into-view'});
|
|
@@ -512,7 +506,7 @@ export async function showContextMenu(
|
|
|
512
506
|
await domNode.focus();
|
|
513
507
|
}, {jslogContext: 'focus'});
|
|
514
508
|
} else if (commentNode) {
|
|
515
|
-
await populateNodeContextMenu(contextMenu, domTreeWidget, domNode
|
|
509
|
+
await populateNodeContextMenu(contextMenu, domTreeWidget, domNode);
|
|
516
510
|
} else if (isPseudoElement) {
|
|
517
511
|
if (domNode.childNodeCount() !== 0 || domNode.hasPseudoElements()) {
|
|
518
512
|
contextMenu.viewSection().appendItem(i18nString(UIStrings.expandRecursively),
|
|
@@ -522,8 +516,7 @@ export async function showContextMenu(
|
|
|
522
516
|
contextMenu.viewSection().appendItem(i18nString(UIStrings.scrollIntoView), () => domNode.scrollIntoView(),
|
|
523
517
|
{jslogContext: 'scroll-into-view'});
|
|
524
518
|
} else if (domNode.nodeType() === Node.PROCESSING_INSTRUCTION_NODE) {
|
|
525
|
-
contextMenu.editSection().appendItem(i18nString(UIStrings.editData),
|
|
526
|
-
() => targetWidget?.startEditingProcessingInstructionValue(),
|
|
519
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.editData), () => domTreeWidget.startEditing(domNode),
|
|
527
520
|
{jslogContext: 'elements.edit-data'});
|
|
528
521
|
contextMenu.editSection().appendItem(i18nString(UIStrings.duplicateElement),
|
|
529
522
|
() => domTreeWidget.duplicateNode(domNode), {
|