chrome-devtools-frontend 1.0.1730971 → 1.0.1732697

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.
Files changed (210) hide show
  1. package/docs/get_the_code.md +1 -73
  2. package/front_end/Tests.js +15 -0
  3. package/front_end/core/host/AidaClient.ts +47 -3
  4. package/front_end/core/host/AidaClientTypes.ts +27 -3
  5. package/front_end/core/host/AidaGcaTranslation.ts +1 -1
  6. package/front_end/core/sdk/DOMModel.ts +8 -3
  7. package/front_end/core/sdk/NetworkManager.ts +2 -1
  8. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
  9. package/front_end/generated/Deprecation.ts +0 -8
  10. package/front_end/generated/InspectorBackendCommands.ts +2 -1
  11. package/front_end/generated/SupportedCSSProperties.ts +2 -2
  12. package/front_end/generated/protocol.ts +9 -0
  13. package/front_end/models/ai-utils/debug.ts +127 -22
  14. package/front_end/models/ai_assistance/README.md +1 -1
  15. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -5
  16. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
  17. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
  18. package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +9 -2
  19. package/front_end/models/ai_assistance/contexts/LighthouseContext.ts +4 -3
  20. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +97 -11
  21. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +92 -43
  22. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
  23. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +26 -26
  24. package/front_end/models/ai_assistance/skills/styling.md +4 -2
  25. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +31 -36
  26. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -1
  27. package/front_end/models/ai_code_completion/ai_code_completion.ts +11 -2
  28. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -1
  29. package/front_end/models/ai_code_generation/ai_code_generation.ts +11 -2
  30. package/front_end/models/bindings/CompilerScriptMapping.ts +0 -1
  31. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1
  32. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -1
  33. package/front_end/models/har/HARFormat.ts +1 -0
  34. package/front_end/models/har/Importer.ts +7 -1
  35. package/front_end/models/har/Log.snapshot.txt +2 -0
  36. package/front_end/models/har/Log.ts +2 -0
  37. package/front_end/models/javascript_metadata/NativeFunctions.ts +0 -4
  38. package/front_end/models/trace/LanternComputationData.ts +4 -0
  39. package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +126 -1
  40. package/front_end/models/trace/lantern/types/Lantern.ts +3 -0
  41. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +33 -1
  42. package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
  43. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
  44. package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
  45. package/front_end/panels/ai_assistance/components/chatInput.css +1 -1
  46. package/front_end/panels/ai_assistance/components/chatMessage.css +3 -4
  47. package/front_end/panels/ai_assistance/components/exploreWidget.css +3 -3
  48. package/front_end/panels/animation/animationTimeline.css +11 -9
  49. package/front_end/panels/application/IndexedDBViews.ts +2 -2
  50. package/front_end/panels/application/PrivateVerificationTokensView.ts +217 -9
  51. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  52. package/front_end/panels/application/ServiceWorkersView.ts +1 -1
  53. package/front_end/panels/application/StorageView.ts +1 -1
  54. package/front_end/panels/application/appManifestView.css +0 -6
  55. package/front_end/panels/application/backgroundServiceView.css +0 -21
  56. package/front_end/panels/application/components/backForwardCacheView.css +1 -9
  57. package/front_end/panels/application/components/endpointsGrid.css +1 -1
  58. package/front_end/panels/application/components/permissionsPolicySection.css +1 -1
  59. package/front_end/panels/application/components/reportsGrid.css +1 -1
  60. package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
  61. package/front_end/panels/application/components/trustTokensView.css +1 -1
  62. package/front_end/panels/application/cookieItemsView.css +0 -1
  63. package/front_end/panels/application/frameDetailsReportView.css +0 -10
  64. package/front_end/panels/application/indexedDBViews.css +0 -10
  65. package/front_end/panels/application/privateVerificationTokensView.css +12 -0
  66. package/front_end/panels/application/resourcesPanel.css +0 -23
  67. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +7 -7
  68. package/front_end/panels/application/serviceWorkersView.css +4 -3
  69. package/front_end/panels/changes/CombinedDiffView.ts +1 -1
  70. package/front_end/panels/comments/CommentsPane.ts +7 -11
  71. package/front_end/panels/common/CommentThreadWidget.ts +11 -3
  72. package/front_end/panels/common/CommentsOverlayWidget.ts +337 -117
  73. package/front_end/panels/console/consoleContextSelector.css +1 -1
  74. package/front_end/panels/console/consolePinPane.css +1 -1
  75. package/front_end/panels/console/consolePrompt.css +4 -2
  76. package/front_end/panels/console/consoleView.css +5 -3
  77. package/front_end/panels/coverage/CoverageView.ts +0 -1
  78. package/front_end/panels/coverage/coverageView.css +4 -3
  79. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +0 -1
  80. package/front_end/panels/elements/AccessibilityTreeView.ts +1 -1
  81. package/front_end/panels/elements/CSSValueTraceView.ts +2 -4
  82. package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
  83. package/front_end/panels/elements/DOMTreeContextMenu.ts +1 -1
  84. package/front_end/panels/elements/DOMTreeWidget.ts +14 -0
  85. package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
  86. package/front_end/panels/elements/PlatformFontsWidget.ts +0 -1
  87. package/front_end/panels/elements/PropertiesWidget.ts +1 -1
  88. package/front_end/panels/elements/PropertyRenderer.ts +7 -27
  89. package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
  90. package/front_end/panels/elements/StylesSidebarPane.ts +2 -0
  91. package/front_end/panels/elements/WebCustomData.ts +1 -1
  92. package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
  93. package/front_end/panels/elements/components/cssVariableValueView.css +3 -1
  94. package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
  95. package/front_end/panels/elements/components/elementsTreeExpandButton.css +3 -2
  96. package/front_end/panels/elements/components/stylePropertyEditor.css +2 -2
  97. package/front_end/panels/elements/layoutPane.css +1 -1
  98. package/front_end/panels/elements/metricsSidebarPane.css +6 -6
  99. package/front_end/panels/elements/platformFontsWidget.css +1 -1
  100. package/front_end/panels/elements/propertiesWidget.css +0 -5
  101. package/front_end/panels/elements/stylesSidebarPane.css +1 -1
  102. package/front_end/panels/emulation/DeviceModeView.ts +4 -3
  103. package/front_end/panels/emulation/deviceModeView.css +9 -10
  104. package/front_end/panels/event_listeners/eventListenersView.css +5 -5
  105. package/front_end/panels/explain/components/consoleInsight.css +5 -20
  106. package/front_end/panels/issues/issuesTree.css +11 -10
  107. package/front_end/panels/layer_viewer/LayerDetailsView.ts +4 -2
  108. package/front_end/panels/layer_viewer/TransformController.ts +106 -54
  109. package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
  110. package/front_end/panels/lighthouse/lighthousePanel.css +5 -8
  111. package/front_end/panels/lighthouse/lighthouseStartView.css +1 -2
  112. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +4 -4
  113. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
  114. package/front_end/panels/media/EventTimelineView.ts +1 -4
  115. package/front_end/panels/media/TickingFlameChart.ts +3 -2
  116. package/front_end/panels/media/playerListView.css +14 -7
  117. package/front_end/panels/media/playerMessagesView.css +11 -7
  118. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
  119. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +5 -7
  120. package/front_end/panels/network/NetworkConfigView.ts +1 -1
  121. package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
  122. package/front_end/panels/network/binaryResourceView.css +0 -7
  123. package/front_end/panels/network/networkConfigView.css +3 -3
  124. package/front_end/panels/network/networkLogView.css +5 -11
  125. package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
  126. package/front_end/panels/network/networkTimingTable.css +6 -6
  127. package/front_end/panels/network/requestConditionsDrawer.css +1 -24
  128. package/front_end/panels/network/requestPayloadView.css +1 -1
  129. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
  130. package/front_end/panels/performance_monitor/performanceMonitor.css +2 -2
  131. package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
  132. package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
  133. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  134. package/front_end/panels/protocol_monitor/protocolMonitor.css +1 -1
  135. package/front_end/panels/recorder/createRecordingView.css +2 -2
  136. package/front_end/panels/recorder/extensionView.css +1 -1
  137. package/front_end/panels/recorder/recorderPanel.css +3 -3
  138. package/front_end/panels/recorder/recordingListView.css +1 -1
  139. package/front_end/panels/recorder/stepEditor.css +2 -2
  140. package/front_end/panels/recorder/stepView.css +0 -31
  141. package/front_end/panels/recorder/timelineSection.css +1 -1
  142. package/front_end/panels/screencast/screencastView.css +3 -2
  143. package/front_end/panels/search/searchView.css +4 -3
  144. package/front_end/panels/security/SecurityPanelSidebar.ts +0 -1
  145. package/front_end/panels/security/mainView.css +2 -2
  146. package/front_end/panels/security/originView.css +1 -5
  147. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +2 -1
  148. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +1 -2
  149. package/front_end/panels/sources/breakpointsView.css +3 -4
  150. package/front_end/panels/sources/tabbedEditorContainer.css +1 -1
  151. package/front_end/panels/sources/watchExpressionsSidebarPane.css +4 -3
  152. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
  153. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +1 -1
  154. package/front_end/panels/timeline/components/OriginMap.ts +1 -1
  155. package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -1
  156. package/front_end/panels/timeline/components/metricCard.css +1 -1
  157. package/front_end/panels/timeline/components/networkRequestDetails.css +0 -1
  158. package/front_end/panels/timeline/components/networkRequestTooltip.css +4 -4
  159. package/front_end/panels/timeline/components/relatedInsightChips.css +1 -1
  160. package/front_end/panels/timeline/timelineFlameChartView.css +4 -4
  161. package/front_end/panels/timeline/timelineFlamechartPopover.css +3 -3
  162. package/front_end/panels/timeline/timelineHistoryManager.css +1 -1
  163. package/front_end/panels/timeline/timelineMiniMap.css +3 -2
  164. package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
  165. package/front_end/panels/web_audio/webAudio.css +0 -20
  166. package/front_end/third_party/chromium/README.chromium +1 -1
  167. package/front_end/ui/comments/CommentAnchorResolver.ts +166 -8
  168. package/front_end/ui/comments/CommentOverlayManager.ts +17 -2
  169. package/front_end/ui/components/buttons/button.css +0 -1
  170. package/front_end/ui/components/diff_view/diffView.css +2 -2
  171. package/front_end/ui/components/markdown_view/codeBlock.css +3 -3
  172. package/front_end/ui/components/markdown_view/markdownView.css +3 -3
  173. package/front_end/ui/components/menus/Menu.ts +1 -1
  174. package/front_end/ui/components/menus/menuItem.css +1 -1
  175. package/front_end/ui/components/panel_feedback/panelFeedback.css +5 -4
  176. package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
  177. package/front_end/ui/components/report_view/reportValue.css +5 -2
  178. package/front_end/ui/components/suggestion_input/suggestionInput.css +6 -6
  179. package/front_end/ui/legacy/ContextMenu.ts +3 -0
  180. package/front_end/ui/legacy/GlassPane.ts +3 -3
  181. package/front_end/ui/legacy/SoftContextMenu.ts +7 -1
  182. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -0
  183. package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +7 -6
  184. package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
  185. package/front_end/ui/legacy/components/inline_editor/cssAngleEditor.css +3 -3
  186. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -1
  187. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
  188. package/front_end/ui/legacy/components/perf_ui/flameChart.css +12 -9
  189. package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +11 -7
  190. package/front_end/ui/legacy/components/perf_ui/pieChart.css +3 -4
  191. package/front_end/ui/legacy/components/source_frame/imageView.css +4 -4
  192. package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
  193. package/front_end/ui/legacy/components/utils/jsUtils.css +2 -1
  194. package/front_end/ui/legacy/dropTarget.css +1 -1
  195. package/front_end/ui/legacy/filter.css +4 -3
  196. package/front_end/ui/legacy/inspectorCommon.css +16 -48
  197. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
  198. package/front_end/ui/legacy/progressIndicator.css +1 -2
  199. package/front_end/ui/legacy/reportView.css +4 -1
  200. package/front_end/ui/legacy/searchableView.css +1 -1
  201. package/front_end/ui/legacy/suggestBox.css +2 -1
  202. package/front_end/ui/legacy/tabbedPane.css +7 -4
  203. package/front_end/ui/legacy/toolbar.css +2 -1
  204. package/front_end/ui/legacy/treeoutline.css +6 -5
  205. package/front_end/ui/legacy/viewContainers.css +3 -2
  206. package/front_end/ui/visual_logging/KnownContextValues.ts +15 -0
  207. package/inspector_overlay/highlight_anchor.ts +8 -11
  208. package/package.json +1 -1
  209. package/front_end/models/ai_code_completion/debug.ts +0 -33
  210. package/front_end/models/ai_code_generation/debug.ts +0 -33
@@ -8,6 +8,12 @@ Lighthouse Version: 1.0.0
8
8
 
9
9
  ## Category Scores
10
10
  - Accessibility: 50
11
+
12
+ ## Failing audits
13
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
14
+
15
+ ### Accessibility (categoryId: "accessibility")
16
+ - Accessibility Audit: 50
11
17
  # Audits for Accessibility
12
18
 
13
19
  The following audits in this category have a score below 90 and may need attention:
@@ -20,7 +26,7 @@ Content:
20
26
  [
21
27
  {
22
28
  "title": "Lighthouse report",
23
- "text": "# Lighthouse Report:\n# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n# Audits for Accessibility\n\nThe following audits in this category have a score below 90 and may need attention:\n- **Accessibility Audit**: 50 (Fail)\n * Description of accessibility audit"
29
+ "text": "# Lighthouse Report:\n# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\nOnly audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50\n# Audits for Accessibility\n\nThe following audits in this category have a score below 90 and may need attention:\n- **Accessibility Audit**: 50 (Fail)\n * Description of accessibility audit"
24
30
  }
25
31
  ]
26
32
  === end content
@@ -36,6 +42,7 @@ Lighthouse Version: 1.0.0
36
42
  - Accessibility: 50
37
43
 
38
44
  ## Failing audits
45
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
39
46
 
40
47
  ### Accessibility (categoryId: "accessibility")
41
48
  - Accessibility Audit: 50
@@ -46,7 +53,7 @@ Content:
46
53
  [
47
54
  {
48
55
  "title": "Lighthouse report",
49
- "text": "# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50"
56
+ "text": "# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\nOnly audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50"
50
57
  }
51
58
  ]
52
59
  === end content
@@ -58,9 +58,10 @@ export class LighthouseContext extends ConversationContext<LHModel.ReporterTypes
58
58
  this.#cachedPayload =
59
59
  '**CRITICAL**: The Lighthouse report failed to record or all category scores are error/unavailable (n/a). This indicates a failed run or missing data.';
60
60
  } else if (Root.Runtime.hostConfig.devToolsAiV2Architecture?.enabled) {
61
- // AI V2 sends failing audit titles without their details to keep the prompt small. The agent
62
- // uses the category IDs in the list to fetch full details with `getLighthouseAudits`.
63
- this.#cachedPayload = `${formatter.summary(this.#lh)}\n\n${formatter.failingAuditsSummary(this.#lh)}`;
61
+ // AI V2 sends the report summary (including failing audit titles without their details) to
62
+ // keep the prompt small. The agent uses the category IDs in the summary to fetch full
63
+ // details with `getLighthouseAudits`.
64
+ this.#cachedPayload = formatter.summary(this.#lh);
64
65
  } else {
65
66
  // The V1 `AccessibilityAgent` expects the accessibility audits up front. Remove this branch with V1.
66
67
  this.#cachedPayload =
@@ -8,6 +8,15 @@ Lighthouse Version: 12.0.0
8
8
  ## Category Scores
9
9
  - Performance: 80
10
10
  - Accessibility: 100
11
+
12
+ ## Failing audits
13
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
14
+
15
+ ### Performance (categoryId: "performance")
16
+ - First Audit: 80
17
+
18
+ ### Accessibility (categoryId: "accessibility")
19
+ - No failing audits.
11
20
  === end content
12
21
 
13
22
  Title: LighthouseFormatter generates audits for a category
@@ -134,17 +143,6 @@ The following audits in this category have a score below 90 and may need attenti
134
143
  * **Est Savings**: 16.9 kB
135
144
  === end content
136
145
 
137
- Title: LighthouseFormatter lists failing audits grouped by category with the category ID
138
- Content:
139
- ## Failing audits
140
-
141
- ### Performance (categoryId: "performance")
142
- - First Audit: 80
143
-
144
- ### Accessibility (categoryId: "accessibility")
145
- - No failing audits.
146
- === end content
147
-
148
146
  Title: LighthouseFormatter formats 0-based source locations as 1-based
149
147
  Content:
150
148
  # Audits for Accessibility
@@ -198,11 +196,29 @@ Mode: navigation
198
196
  ## Category Scores
199
197
  - Performance: 80
200
198
  - Agentic Browsing: 1/2 audits passed
199
+
200
+ ## Failing audits
201
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
202
+
203
+ ### Performance (categoryId: "performance")
204
+ - First Audit: 80
205
+
206
+ ### Agentic Browsing (categoryId: "agentic-browsing")
207
+ - llms.txt is valid: 0
201
208
  === end content
202
209
 
203
210
  Title: LighthouseFormatter surfaces errored audits
204
211
  Content:
212
+ # Lighthouse Report Summary
213
+ URL: https://example.com
214
+ Fetch Time: 2025-01-01T00:00:00.000Z
215
+ Lighthouse Version: 12.0.0
216
+
217
+ ## Category Scores
218
+ - Performance: 50
219
+
205
220
  ## Failing audits
221
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
206
222
 
207
223
  ### Performance (categoryId: "performance")
208
224
  - First Audit: 80
@@ -219,9 +235,19 @@ The following audits in this category errored:
219
235
  * An audit that threw an error during execution.
220
236
  * Error: Audit execution timed out
221
237
  === end content
238
+
222
239
  Title: LighthouseFormatter excludes hidden audits
223
240
  Content:
241
+ # Lighthouse Report Summary
242
+ URL: https://example.com
243
+ Fetch Time: 2025-01-01T00:00:00.000Z
244
+ Lighthouse Version: 12.0.0
245
+
246
+ ## Category Scores
247
+ - Performance: 100
248
+
224
249
  ## Failing audits
250
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
225
251
 
226
252
  ### Performance (categoryId: "performance")
227
253
  - No failing audits.
@@ -291,3 +317,63 @@ The following audits in this category have a score below 90 and may need attenti
291
317
  - https://example.com/font.woff2 (650 ms, 16.4 kB) (longest chain)
292
318
  - https://example.com/app.js (400 ms, 2 kB)
293
319
  === end content
320
+
321
+ Title: LighthouseFormatter surfaces non-hidden informative audits with details
322
+ Content:
323
+ # Lighthouse Report Summary
324
+ URL: https://example.com
325
+ Fetch Time: 2025-01-01T00:00:00.000Z
326
+ Lighthouse Version: 12.0.0
327
+
328
+ ## Category Scores
329
+ - Agentic Browsing: 0/0 audits passed
330
+ - Performance: 80
331
+
332
+ ## Failing audits
333
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
334
+
335
+ ### Agentic Browsing (categoryId: "agentic-browsing")
336
+ - No audits scored below 90, but these informative audits report findings:
337
+ - Informative Audit With Score 1
338
+
339
+ ### Performance (categoryId: "performance")
340
+ - First Audit: 80
341
+ - Informative audits:
342
+ - Minimize main-thread work
343
+
344
+ # Audits for Agentic Browsing
345
+
346
+ Informative audits:
347
+ - **Informative Audit With Score 1**: informative (1 item found)
348
+ * Informative audit whose score is 1.
349
+
350
+ - Item:
351
+ * **Name**: exampleItem
352
+
353
+ # Audits for Performance
354
+
355
+ The following audits in this category have a score below 90 and may need attention:
356
+ - **First Audit**: 80 (1.2s)
357
+ * Description of first audit
358
+
359
+ Informative audits:
360
+ - **Minimize main-thread work**: informative (2.5 s)
361
+ * Consider reducing the time spent parsing, compiling and executing JS.
362
+
363
+ - Item:
364
+ * **Category**: Script Evaluation
365
+ * **Time Spent**: 1,800 ms
366
+ === end content
367
+
368
+ Title: LighthouseFormatter filters webmcp-registered-tools table columns to tool and description
369
+ Content:
370
+ # Audits for Agentic Browsing
371
+
372
+ Informative audits:
373
+ - **Registered WebMCP tools**: informative (1 tool registered)
374
+ * Lists WebMCP tools registered on the page.
375
+
376
+ - Item:
377
+ * **Tool Name**: searchProducts
378
+ * **Description**: Searches the product catalog by keyword.
379
+ === end content
@@ -11,6 +11,12 @@ import {bytes, millis} from './UnitFormatters.js';
11
11
  // not export `Util`, so this threshold is defined locally.
12
12
  const PASS_THRESHOLD = 0.9;
13
13
 
14
+ const AUDIT_TABLE_COLUMN_KEYS = new Map<string, ReadonlySet<string>>([
15
+ // For webmcp-registered-tools, only include the tool name and description to
16
+ // keep the output concise (omitting inputSchema, source, and element).
17
+ ['webmcp-registered-tools', new Set(['tool', 'description'])],
18
+ ]);
19
+
14
20
  /**
15
21
  * Category argument for Lighthouse tools, accepting a specific category ID or `'all'`
16
22
  * to target a full report across all standard categories.
@@ -23,7 +29,18 @@ export type LighthouseCategoryArg = 'all'|LHModel.RunTypes.CategoryId;
23
29
  */
24
30
  export class LighthouseFormatter {
25
31
  /**
26
- * Returns an overall summary and high-level overview of the Lighthouse report.
32
+ * Returns an overall summary and high-level overview of the Lighthouse report
33
+ * for the initial conversation context payload.
34
+ *
35
+ * Includes:
36
+ * - Report metadata (URL, fetch time, Lighthouse version, and gather mode when present).
37
+ * - Category scores (0-100 percentage, "n/a", or "<passed>/<total> audits passed" for
38
+ * fraction-scored modes and categories).
39
+ * - A per-category overview of non-hidden failing audits (score < 90), errored audits
40
+ * (with their error messages), and informative audits that carry details, without
41
+ * full descriptions or details tables so the prompt stays compact. Each category
42
+ * heading includes its category ID so the agent can request full details via
43
+ * `getLighthouseAudits`.
27
44
  */
28
45
  summary(report: LHModel.ReporterTypes.ReportJSON): string {
29
46
  const lines: string[] = [];
@@ -39,6 +56,38 @@ export class LighthouseFormatter {
39
56
  for (const category of Object.values(report.categories)) {
40
57
  lines.push(`- ${category.title}: ${this.#formatCategoryScore(report, category)}`);
41
58
  }
59
+ lines.push('');
60
+ lines.push('## Failing audits');
61
+ lines.push(
62
+ 'Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.');
63
+ for (const [categoryId, category] of Object.entries(report.categories)) {
64
+ lines.push('');
65
+ lines.push(`### ${category.title} (categoryId: "${categoryId}")`);
66
+ const failingAudits = this.#findFailingAudits(report, category);
67
+ const erroredAudits = this.#findErroredAudits(report, category);
68
+ const informativeAudits = this.#findInformativeAuditsToReport(report, category);
69
+ if (failingAudits.length === 0 && erroredAudits.length === 0 && informativeAudits.length === 0) {
70
+ lines.push('- No failing audits.');
71
+ continue;
72
+ }
73
+ for (const audit of failingAudits) {
74
+ lines.push(`- ${audit.title}: ${this.#formatScore(audit.score)}`);
75
+ }
76
+ for (const audit of erroredAudits) {
77
+ const errorSuffix = audit.errorMessage ? ` (${this.#toSingleLine(audit.errorMessage)})` : '';
78
+ lines.push(`- ${audit.title}: Error${errorSuffix}`);
79
+ }
80
+ if (informativeAudits.length > 0) {
81
+ if (failingAudits.length === 0 && erroredAudits.length === 0) {
82
+ lines.push('- No audits scored below 90, but these informative audits report findings:');
83
+ } else {
84
+ lines.push('- Informative audits:');
85
+ }
86
+ for (const audit of informativeAudits) {
87
+ lines.push(` - ${audit.title}`);
88
+ }
89
+ }
90
+ }
42
91
  return lines.join('\n');
43
92
  }
44
93
 
@@ -105,34 +154,6 @@ export class LighthouseFormatter {
105
154
  }
106
155
  }
107
156
 
108
- /**
109
- * Returns the title and score of every failing audit (score < 90), grouped by category.
110
- * Descriptions and details tables are left out to keep the prompt small. Each category
111
- * heading includes its category ID so the agent can request the full audit details.
112
- */
113
- failingAuditsSummary(report: LHModel.ReporterTypes.ReportJSON): string {
114
- const lines: string[] = [];
115
- lines.push('## Failing audits');
116
- for (const [categoryId, category] of Object.entries(report.categories)) {
117
- lines.push('');
118
- lines.push(`### ${category.title} (categoryId: "${categoryId}")`);
119
- const failingAudits = this.#findFailingAudits(report, category);
120
- const erroredAudits = this.#findErroredAudits(report, category);
121
- if (failingAudits.length === 0 && erroredAudits.length === 0) {
122
- lines.push('- No failing audits.');
123
- continue;
124
- }
125
- for (const audit of failingAudits) {
126
- lines.push(`- ${audit.title}: ${this.#formatScore(audit.score)}`);
127
- }
128
- for (const audit of erroredAudits) {
129
- const errorSuffix = audit.errorMessage ? ` (${this.#toSingleLine(audit.errorMessage)})` : '';
130
- lines.push(`- ${audit.title}: Error${errorSuffix}`);
131
- }
132
- }
133
- return lines.join('\n');
134
- }
135
-
136
157
  /**
137
158
  * Formats a Lighthouse report for an AI Agent. If categoryId is 'all', returns
138
159
  * each category's audits. Otherwise, returns audits for the specified category.
@@ -166,8 +187,9 @@ export class LighthouseFormatter {
166
187
 
167
188
  const failingAudits = this.#findFailingAudits(report, category);
168
189
  const erroredAudits = this.#findErroredAudits(report, category);
190
+ const informativeAudits = this.#findInformativeAuditsToReport(report, category);
169
191
 
170
- if (failingAudits.length === 0 && erroredAudits.length === 0) {
192
+ if (failingAudits.length === 0 && erroredAudits.length === 0 && informativeAudits.length === 0) {
171
193
  lines.push('All audits in this category passed (score >= 90).');
172
194
  return lines.join('\n');
173
195
  }
@@ -190,6 +212,14 @@ export class LighthouseFormatter {
190
212
  sections.push(sectionLines.join('\n'));
191
213
  }
192
214
 
215
+ if (informativeAudits.length > 0) {
216
+ const sectionLines = ['Informative audits:'];
217
+ for (const audit of informativeAudits) {
218
+ sectionLines.push(...this.#formatAudit(audit, 'informative'));
219
+ }
220
+ sections.push(sectionLines.join('\n'));
221
+ }
222
+
193
223
  lines.push(sections.join('\n\n'));
194
224
  return lines.join('\n');
195
225
  }
@@ -214,7 +244,7 @@ export class LighthouseFormatter {
214
244
  }
215
245
  }
216
246
  if (audit.details) {
217
- const formattedDetails = this.#formatDetails(audit.details);
247
+ const formattedDetails = this.#formatDetails(audit.details, audit.id);
218
248
  if (formattedDetails) {
219
249
  lines.push('');
220
250
  lines.push(formattedDetails.split('\n').map(l => l ? ` ${l}` : '').join('\n'));
@@ -233,7 +263,8 @@ export class LighthouseFormatter {
233
263
  return category.auditRefs.filter(ref => ref.group !== 'hidden')
234
264
  .map(ref => report.audits[ref.id])
235
265
  .filter((audit): audit is LHModel.ReporterTypes.AuditResultJSON&{score: number} => Boolean(audit) &&
236
- audit.scoreDisplayMode !== 'error' && audit.score !== null && audit.score < PASS_THRESHOLD);
266
+ audit.scoreDisplayMode !== 'error' && audit.scoreDisplayMode !== 'informative' &&
267
+ audit.score !== null && audit.score < PASS_THRESHOLD);
237
268
  }
238
269
 
239
270
  /**
@@ -248,11 +279,26 @@ export class LighthouseFormatter {
248
279
  Boolean(audit) && audit.scoreDisplayMode === 'error');
249
280
  }
250
281
 
282
+ /**
283
+ * Returns non-hidden informative audits (`scoreDisplayMode === 'informative'`)
284
+ * that carry details to display. Informative audits may have `score: null` or
285
+ * `score: 1` (for example, `webmcp-registered-tools`), so `#findFailingAudits`
286
+ * also excludes `scoreDisplayMode === 'informative'`.
287
+ */
288
+ #findInformativeAuditsToReport(report: LHModel.ReporterTypes.ReportJSON,
289
+ category: LHModel.ReporterTypes.CategoryJSON):
290
+ LHModel.ReporterTypes.AuditResultJSON[] {
291
+ return category.auditRefs.filter(ref => ref.group !== 'hidden')
292
+ .map(ref => report.audits[ref.id])
293
+ .filter((audit): audit is LHModel.ReporterTypes.AuditResultJSON =>
294
+ Boolean(audit) && audit.scoreDisplayMode === 'informative' && Boolean(audit.details));
295
+ }
296
+
251
297
  #formatScore(score: number): number {
252
298
  return Math.round(score * 100);
253
299
  }
254
300
 
255
- #formatDetails(details: LHModel.ReporterTypes.DetailsJSON): string {
301
+ #formatDetails(details: LHModel.ReporterTypes.DetailsJSON, auditId?: string): string {
256
302
  switch (details.type) {
257
303
  case 'table': {
258
304
  const lines: string[] = [];
@@ -270,7 +316,7 @@ export class LighthouseFormatter {
270
316
  lines.push(summaryParts.join('\n'));
271
317
  }
272
318
  }
273
- lines.push(this.#formatTable(details.headings, details.items));
319
+ lines.push(this.#formatTable(details.headings, details.items, auditId));
274
320
  return lines.join('\n');
275
321
  }
276
322
  case 'opportunity': {
@@ -285,11 +331,11 @@ export class LighthouseFormatter {
285
331
  if (summaryParts.length > 0) {
286
332
  lines.push(summaryParts.join(', '));
287
333
  }
288
- lines.push(this.#formatTable(details.headings, details.items));
334
+ lines.push(this.#formatTable(details.headings, details.items, auditId));
289
335
  return lines.join('\n');
290
336
  }
291
337
  case 'list':
292
- return this.#formatList(details);
338
+ return this.#formatList(details, auditId);
293
339
  case 'checklist':
294
340
  return Object.values(details.items)
295
341
  .map(item => `- ${this.#toSingleLine(item.label)}: ${item.value ? 'Passed' : 'Failed'}`)
@@ -324,7 +370,7 @@ export class LighthouseFormatter {
324
370
  return lines;
325
371
  }
326
372
 
327
- #formatList(details: LHModel.ReporterTypes.ListDetailsJSON): string {
373
+ #formatList(details: LHModel.ReporterTypes.ListDetailsJSON, auditId?: string): string {
328
374
  const itemStrings: string[] = [];
329
375
  for (const item of details.items) {
330
376
  if (item.type === 'list-section') {
@@ -335,7 +381,7 @@ export class LighthouseFormatter {
335
381
  if (item.description) {
336
382
  sectionLines.push(this.#toSingleLine(item.description));
337
383
  }
338
- const formattedValue = this.#formatListValue(item.value);
384
+ const formattedValue = this.#formatListValue(item.value, auditId);
339
385
  if (formattedValue) {
340
386
  sectionLines.push(formattedValue);
341
387
  }
@@ -343,7 +389,7 @@ export class LighthouseFormatter {
343
389
  itemStrings.push(sectionLines.join('\n'));
344
390
  }
345
391
  } else {
346
- const formattedItem = this.#formatListValue(item);
392
+ const formattedItem = this.#formatListValue(item, auditId);
347
393
  if (formattedItem) {
348
394
  itemStrings.push(formattedItem);
349
395
  }
@@ -352,7 +398,7 @@ export class LighthouseFormatter {
352
398
  return itemStrings.join('\n\n');
353
399
  }
354
400
 
355
- #formatListValue(value: LHModel.ReporterTypes.ListItemValueJSON): string {
401
+ #formatListValue(value: LHModel.ReporterTypes.ListItemValueJSON, auditId?: string): string {
356
402
  switch (value.type) {
357
403
  case 'node':
358
404
  return this.#formatNodeFields(value)
@@ -365,7 +411,7 @@ export class LighthouseFormatter {
365
411
  case 'url':
366
412
  return this.#toSingleLine(value.value);
367
413
  default:
368
- return this.#formatDetails(value);
414
+ return this.#formatDetails(value, auditId);
369
415
  }
370
416
  }
371
417
 
@@ -388,12 +434,15 @@ export class LighthouseFormatter {
388
434
  return results;
389
435
  }
390
436
 
391
- #formatTable(headings: LHModel.ReporterTypes.TableHeadingJSON[], items: LHModel.ReporterTypes.TableItem[]): string {
437
+ #formatTable(headings: LHModel.ReporterTypes.TableHeadingJSON[], items: LHModel.ReporterTypes.TableItem[],
438
+ auditId?: string): string {
392
439
  const lines: string[] = [];
440
+ const allowedKeys = auditId ? AUDIT_TABLE_COLUMN_KEYS.get(auditId) : undefined;
441
+ const filteredHeadings = allowedKeys ? headings.filter(h => allowedKeys.has(h.key)) : headings;
393
442
 
394
443
  for (const item of items) {
395
444
  const itemLines: string[] = [];
396
- for (const heading of headings) {
445
+ for (const heading of filteredHeadings) {
397
446
  const value = item[heading.key] as LHModel.ReporterTypes.TableItemValue;
398
447
  const formattedValues = this.#formatTableValues(value, heading.valueType);
399
448
  for (const {labelSuffix, value: v} of formattedValues) {
@@ -950,7 +950,7 @@ Increasing the image compression factor could improve this image’s download si
950
950
  - Optimizations:
951
951
  This image file is larger than it needs to be (2048x1356) for its displayed dimensions (200x132). Use responsive images to reduce the image download size. (Est 41.4 kB)
952
952
 
953
- ## Estimated savings: FCP 0 ms, LCP 100 ms
953
+ ## Estimated savings: FCP 0 ms, LCP 0 ms
954
954
 
955
955
  ## External resources:
956
956
  - https://developer.chrome.com/docs/performance/insights/image-delivery
@@ -478,19 +478,6 @@ Metrics (lab / observed):
478
478
  - CLS: 0.31, event: (eventKey: c-13074, ts: 59729100192)
479
479
  Metrics (field / real users): n/a – no data for this page in CrUX
480
480
  Available insights:
481
- - insight name: Cache
482
- description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
483
- relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
484
- estimated metric savings: FCP 0 ms, LCP 150 ms
485
- estimated wasted bytes: 971.5 kB
486
- example question: What caching strategies can I apply to improve my page performance?
487
- - insight name: ImageDelivery
488
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
489
- relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
490
- estimated metric savings: FCP 0 ms, LCP 100 ms
491
- estimated wasted bytes: 2 MB
492
- example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
493
- example question: Are all images on my site optimized?
494
481
  - insight name: LCPBreakdown
495
482
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
496
483
  relevant trace bounds: {min: 59728649746µs, max: 59729312744µs}
@@ -508,6 +495,13 @@ Available insights:
508
495
  relevant trace bounds: {min: 59729100192µs, max: 59730317334µs}
509
496
  example question: Help me optimize my CLS score
510
497
  example question: How can I prevent layout shifts on this page?
498
+ - insight name: ImageDelivery
499
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
500
+ relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
501
+ estimated metric savings: FCP 0 ms, LCP 0 ms
502
+ estimated wasted bytes: 2 MB
503
+ example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
504
+ example question: Are all images on my site optimized?
511
505
  - insight name: DocumentLatency
512
506
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
513
507
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -524,6 +518,12 @@ Available insights:
524
518
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page’s content.
525
519
  relevant trace bounds: {min: 59728701403µs, max: 59729465969µs}
526
520
  example question: Which third parties are having the largest impact on my page performance?
521
+ - insight name: Cache
522
+ description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
523
+ relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
524
+ estimated metric savings: FCP 0 ms, LCP 0 ms
525
+ estimated wasted bytes: 971.5 kB
526
+ example question: What caching strategies can I apply to improve my page performance?
527
527
  - insight name: CharacterSet
528
528
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
529
529
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -562,19 +562,6 @@ Metrics (field / real users):
562
562
  - The scope indicates if the data came from the entire origin, or a specific url
563
563
  - Lab metrics describe how this specific page load performed, while field metrics are an aggregation of results from real-world users. Best practice is to prioritize metrics that are bad in field data. Lab metrics may be better or worse than fields metrics depending on the developer's machine, network, or the actions performed while tracing.
564
564
  Available insights:
565
- - insight name: Cache
566
- description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
567
- relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
568
- estimated metric savings: FCP 0 ms, LCP 150 ms
569
- estimated wasted bytes: 971.5 kB
570
- example question: What caching strategies can I apply to improve my page performance?
571
- - insight name: ImageDelivery
572
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
573
- relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
574
- estimated metric savings: FCP 0 ms, LCP 100 ms
575
- estimated wasted bytes: 2 MB
576
- example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
577
- example question: Are all images on my site optimized?
578
565
  - insight name: LCPBreakdown
579
566
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
580
567
  relevant trace bounds: {min: 59728649746µs, max: 59729312744µs}
@@ -592,6 +579,13 @@ Available insights:
592
579
  relevant trace bounds: {min: 59729100192µs, max: 59730317334µs}
593
580
  example question: Help me optimize my CLS score
594
581
  example question: How can I prevent layout shifts on this page?
582
+ - insight name: ImageDelivery
583
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
584
+ relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
585
+ estimated metric savings: FCP 0 ms, LCP 0 ms
586
+ estimated wasted bytes: 2 MB
587
+ example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
588
+ example question: Are all images on my site optimized?
595
589
  - insight name: DocumentLatency
596
590
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
597
591
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -608,6 +602,12 @@ Available insights:
608
602
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page’s content.
609
603
  relevant trace bounds: {min: 59728701403µs, max: 59729465969µs}
610
604
  example question: Which third parties are having the largest impact on my page performance?
605
+ - insight name: Cache
606
+ description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
607
+ relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
608
+ estimated metric savings: FCP 0 ms, LCP 0 ms
609
+ estimated wasted bytes: 971.5 kB
610
+ example question: What caching strategies can I apply to improve my page performance?
611
611
  - insight name: CharacterSet
612
612
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
613
613
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -20,10 +20,12 @@ The user selected a DOM element in DevTools and asks a query about the element o
20
20
  - Geometry & layout inspection example:
21
21
  ```javascript
22
22
  const rect = $0.getBoundingClientRect();
23
+ const style = window.getComputedStyle($0);
24
+ const parentStyle = $0.parentElement ? window.getComputedStyle($0.parentElement) : null;
23
25
  const data = {
24
26
  rect: {width: rect.width, height: rect.height, top: rect.top, left: rect.left},
25
- computedDisplay: window.getComputedStyle($0).display,
26
- parentDisplay: $0.parentElement ? window.getComputedStyle($0.parentElement).display : null,
27
+ computedDisplay: style.display,
28
+ parentDisplay: parentStyle?.display ?? null,
27
29
  };
28
30
  ```
29
31
  - Style modification example (ALWAYS use `setElementStyles`):