Merge pull request #858 from davep/dom-queries-typo-squish

DOM Queries typo squish
This commit is contained in:
Will McGugan
2022-10-09 20:48:53 +01:00
committed by GitHub

View File

@@ -26,7 +26,7 @@ If the matched widget is *not* a button (i.e. if `isinstance(widget, Button)` eq
!!! tip
The second parameter allows type-checkers like MyPy know the exact return type. Without it, MyPy would only know the result of `query_one` is a Widget (the base class).
The second parameter allows type-checkers like MyPy to know the exact return type. Without it, MyPy would only know the result of `query_one` is a Widget (the base class).
## Making queries
@@ -116,7 +116,7 @@ If the last widget is *not* a button, Textual will raise a [WrongType][textual.c
## Filter
Query objects have a [filter][textual.css.query.DOMQuery.filter] method which further refines a query. This method will return a new query object which widgets that match both the original query _and_ the new selector
Query objects have a [filter][textual.css.query.DOMQuery.filter] method which further refines a query. This method will return a new query object with widgets that match both the original query _and_ the new selector
Let's say we have a query which gets all the buttons in an app, and we want a new query object with just the disabled buttons. We could write something like this:
@@ -131,7 +131,7 @@ Iterating over `disabled_buttons` will give us all the disabled buttons.
## Exclude
Query objects have a [exclude][textual.css.query.DOMQuery.exclude] method which is the logical opposite of [filter][textual.css.query.DOMQuery.filter]. The `exclude` method removes any widgets from the query object which match a selector.
Query objects have an [exclude][textual.css.query.DOMQuery.exclude] method which is the logical opposite of [filter][textual.css.query.DOMQuery.filter]. The `exclude` method removes any widgets from the query object which match a selector.
Here's how we could get all the buttons which *don't* have the `disabled` class set.