Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider ampersand in queries #3512

Open
willmcgugan opened this issue Oct 11, 2023 · 3 comments
Open

Consider ampersand in queries #3512

willmcgugan opened this issue Oct 11, 2023 · 3 comments
Labels
enhancement New feature or request Task

Comments

@willmcgugan
Copy link
Collaborator

It may be nice to add a syntax to queries which refers to the current widget.

For instance, if I want to get the immediate child of a widget, I could do this:

self.query("& > Child")

Currently that's rather awkward to implement.

We can also extend this to the CSS itself. i.e. ini a CSS or DEFAULT_CSS. For instance the following would style the widget without the need to specify its type again:

DEFAULT_CSS = """
& { border: heavy red}
"""

Currently, you have to do this:

DEFAULT_CSS = """
MyWidget { border: heavy red}
"""
@davep davep added enhancement New feature or request Task labels Oct 12, 2023
@davep
Copy link
Contributor

davep commented Mar 26, 2024

Closing as this was implemented as part of nested CSS.

@davep davep closed this as completed Mar 26, 2024
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@davep
Copy link
Contributor

davep commented Mar 26, 2024

Ignore that, reopening as this is different from nested CSS (was only half reading).

@davep davep reopened this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

No branches or pull requests

2 participants