MCPcopy
hub / github.com/bubkoo/html-to-image / cloneNode

Function cloneNode

src/clone-node.ts:251–265  ·  view source on GitHub ↗
(
  node: T,
  options: Options,
  isRoot?: boolean,
)

Source from the content-addressed store, hash-verified

249}
250
251export async function cloneNode<T extends HTMLElement>(
252 node: T,
253 options: Options,
254 isRoot?: boolean,
255): Promise<T | null> {
256 if (!isRoot && options.filter && !options.filter(node)) {
257 return null
258 }
259
260 return Promise.resolve(node)
261 .then((clonedNode) => cloneSingleNode(clonedNode, options) as Promise<T>)
262 .then((clonedNode) => cloneChildren(node, clonedNode, options))
263 .then((clonedNode) => decorate(node, clonedNode, options))
264 .then((clonedNode) => ensureSVGSymbols(clonedNode, options))
265}

Callers 4

toSvgFunction · 0.90
cloneIFrameElementFunction · 0.85
cloneChildrenFunction · 0.85
ensureSVGSymbolsFunction · 0.85

Calls 4

cloneSingleNodeFunction · 0.85
cloneChildrenFunction · 0.85
decorateFunction · 0.85
ensureSVGSymbolsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…