Skip to content

createSvg<K>

Creates an SVG element in the SVG namespace and appends it to this node, or prepends it when o.prepend is set.

Import:

import 'obsidian-test-mocks/setup';

Signature:

function createSvg(this: Node, tag: K, o: string | SvgElementInfo | undefined, callback: ((el: SVGElementTagNameMap[K]) => void) | undefined): SVGElementTagNameMap[K]

Parameters:

Parameter Type Description
this Node
tag K The tag name of the SVG element to create.
o string | SvgElementInfo | undefined A class name, or the element’s options; any parent given there is replaced by this node.
callback ((el: SVGElementTagNameMap[K]) => void) | undefined Called with the new element before it is returned.

Returns: SVGElementTagNameMap[K] — The new SVG element.