MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / moveChildNodes

Method moveChildNodes

src/TextSnapshot.ts:273–298  ·  view source on GitHub ↗
(
      attachTarget: TextSnapshotNode,
      extraNode: TextSnapshotNode,
      descendantIds: Set<number>,
    )

Source from the content-addressed store, hash-verified

271 };
272
273 const moveChildNodes = (
274 attachTarget: TextSnapshotNode,
275 extraNode: TextSnapshotNode,
276 descendantIds: Set<number>,
277 ): number => {
278 let firstMovedIndex = -1;
279 if (descendantIds.size > 0 && attachTarget.children) {
280 const remainingChildren: TextSnapshotNode[] = [];
281 for (const child of attachTarget.children) {
282 if (child.backendNodeId && descendantIds.has(child.backendNodeId)) {
283 if (firstMovedIndex === -1) {
284 firstMovedIndex = remainingChildren.length;
285 }
286 extraNode.children.push(child);
287 } else {
288 remainingChildren.push(child);
289 }
290 }
291 attachTarget.children = remainingChildren;
292 }
293 return firstMovedIndex !== -1
294 ? firstMovedIndex
295 : attachTarget.children
296 ? attachTarget.children.length
297 : 0;
298 };
299
300 if (extraHandles.length) {
301 page.extraHandles = extraHandles;

Callers

nothing calls this directly

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected