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

EVENTS: Does inline event handler body have to be valid JS? #5

Open
pauleveritt opened this issue Oct 16, 2022 · 0 comments
Open

EVENTS: Does inline event handler body have to be valid JS? #5

pauleveritt opened this issue Oct 16, 2022 · 0 comments

Comments

@pauleveritt
Copy link
Contributor

A question about a constraint or non-constraint in this discussion. If non-constraint...I'll have another proposal.

First, a number of quite-cool ideas in Ted's proposal. MDN strongly recommends against inline event handlers. @handler(event_name, event_target) makes for something a lot more convenient than inline, so people will use it.

When people do use inline...for example in py-event_api.html:

<div py-mousemove="move">py-mousemove</div>

Does the attribute value -- move -- have to be a valid JS expression, pointing at a known symbol?

I think JS tooling doesn't really care, because JS (in browser) scopes are such a mess. Symbols can arrive async, so static analysis can never know.

I mean more "do we care"? Are we ok with saying: "Sure, your expectation is thatmove will exist in JS, but really, there's just this sort-of-anonymous proxy created by Python code via Pyodide".

I view the <button onclick="py.foo()"> as a bit more promising in this regard. There can be an actual py object in JS.

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