Description
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.