draft feat: get_css_style tool - #2612
Conversation
OrKoN
left a comment
There was a problem hiding this comment.
Thanks! Left a few comments on the overall approach.
| import {ToolCategory} from './categories.js'; | ||
| import {definePageTool, type MatchedStyles} from './ToolDefinition.js'; | ||
|
|
||
| const INHERITED_PROPERTIES = new Set([ |
There was a problem hiding this comment.
I think this should exist in DevTools? we should re-use it, or introduce it there.
| ); | ||
| } | ||
|
|
||
| function formatCssStyles(matchedStyles: MatchedStyles, uid: string): string { |
There was a problem hiding this comment.
can we re-use any formatters on the DevTools side? If not (even by refactoring presenters), we should extract this in a separate formatter in this repo.
| } | ||
|
|
||
| await domModel.requestDocument(); | ||
| const nodeMap = await domModel.pushNodesByBackendIdsToFrontend( |
There was a problem hiding this comment.
we should not need to push nodes to the frontend. Can we just use the CSS logic relying on backend node IDs only?
| } | ||
|
|
||
| const devtools = await this.ensureDevToolsUniverse(); | ||
| const domModel = devtools.target.model(DevTools.DOMModel.DOMModel); |
There was a problem hiding this comment.
uid might belong to iframes for we need to find the right target instance
| ); | ||
| } | ||
|
|
||
| const devtools = await this.ensureDevToolsUniverse(); |
There was a problem hiding this comment.
do we need to ensure the universe here? I think it should automatically exist when the page is available. Let's throw an error if it does not exist instead?
|
|
||
| let backendNodeId = node.backendNodeId; | ||
| if (!backendNodeId) { | ||
| using handle = await this.#resolveElementHandle(node, uid); |
There was a problem hiding this comment.
could we resolve without creating a handle?
No description provided.