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

Function isInstanceOfElement

src/util.ts:245–261  ·  view source on GitHub ↗
(
  node: Element | HTMLElement | SVGImageElement,
  instance: T,
)

Source from the content-addressed store, hash-verified

243}
244
245export const isInstanceOfElement = <
246 T extends typeof Element | typeof HTMLElement | typeof SVGImageElement,
247>(
248 node: Element | HTMLElement | SVGImageElement,
249 instance: T,
250): node is T['prototype'] => {
251 if (node instanceof instance) return true
252
253 const nodePrototype = Object.getPrototypeOf(node)
254
255 if (nodePrototype === null) return false
256
257 return (
258 nodePrototype.constructor.name === instance.name ||
259 isInstanceOfElement(nodePrototype, instance)
260 )
261}

Callers 8

cloneSingleNodeFunction · 0.90
cloneChildrenFunction · 0.90
cloneCSSStyleFunction · 0.90
cloneInputValueFunction · 0.90
cloneSelectValueFunction · 0.90
decorateFunction · 0.90
embedImageNodeFunction · 0.90
embedImagesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…