Skip to content

Element.findAllSelf method

Element › findAllSelf

Official

Finds all descendant elements or self that match the selector.

Signature:

findAllSelf(selector: string): Element[]

Parameters:

Parameter Type Description
selector string The selector to find the elements with.

Returns: Element[]An array of all descendant elements or self that match the selector.

Remarks:

See bug https://forum.obsidian.md/t/bug-find-findall-findallself/98108.

Example:

const element = createEl('p', { cls: 'foo' });
element.createEl('strong', { cls: 'foo' });
console.log(element.findAllSelf('.foo')); // [<p class="foo"></p>, <strong class="foo"></strong>]
console.log(element.findAllSelf('.bar')); // []