Skip to content

textual.css.query

This module contains the DOMQuery class and related objects.

A DOMQuery is a set of DOM nodes returned by query.

The set of nodes may be further refined with filter and exclude. Additional methods apply actions to all nodes in the query.

Info

If this sounds like JQuery, a (once) popular JS library, it is no coincidence.

ExpectType module-attribute

ExpectType = TypeVar('ExpectType')

Type variable used to further restrict queries.

QueryType module-attribute

QueryType = TypeVar('QueryType', bound='Widget')

Type variable used to type generic queries.

DOMQuery

DOMQuery(
    node,
    *,
    filter=None,
    exclude=None,
    deep=True,
    parent=None
)

Bases: Generic[QueryType]

Warning

You won't need to construct this manually, as DOMQuery objects are returned by query.

Parameters:

Name Type Description Default

node

DOMNode

A DOM node.

required

filter

str | None

Query to filter children in the node.

None

exclude

str | None

Query to exclude children in the node.

None

deep