Skip to content

createSpan

Creates a <span> and appends it to this node, as createEl does.

Import:

import 'obsidian-test-mocks/setup';

Signature:

function createSpan(this: Node, o: string | DomElementInfo | undefined, callback: ((el: HTMLSpanElement) => void) | undefined): HTMLSpanElement

Parameters:

Parameter Type Description
this Node
o string | DomElementInfo | undefined A class name, or the element’s options; the parent is always this node.
callback ((el: HTMLSpanElement) => void) | undefined Called with the new element before it is returned.

Returns: HTMLSpanElement — The new \<span\>.