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

EVENT: Use a query selector for the element spec #6

Open
pauleveritt opened this issue Oct 16, 2022 · 1 comment
Open

EVENT: Use a query selector for the element spec #6

pauleveritt opened this issue Oct 16, 2022 · 1 comment

Comments

@pauleveritt
Copy link
Contributor

In the proposal, you might write: @handler( event="mousemove", element=Element("empty_button").element )

Instead, I propose allowing element: Element | str. If it is a string, then use document.querySelector. This would have a few benefits:

  • It's nicer. 😀
  • It doesn't require evaluation at import time.
  • It could match multiple nodes and attach handlers to them.
@pauleveritt
Copy link
Contributor Author

On the last point...we'd want to make sure we don't register a pile of proxies for every matching node. For example, a Delete button on a row of a todo app. (Of course, people should register the handler on the container, but...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant