Ted Patrick
Ted Patrick
You can also use a create_proxy ```html add_event_listener passes event from pyodide.ffi import create_proxy def hello_args(*args): console.log(f"Hi! I got some args! {args}") Element('two').element.addEventListener("click", create_proxy(hello_args)) ```
That syntax is what several leading JS frameworks do today, it isn't standard but it is the common syntax for assigning attributes function values by name. [vue](https://vuejs.org/guide/essentials/event-handling.html#method-handlers) [react](https://reactjs.org/docs/handling-events.html) [svelte](https://svelte.dev/tutorial/component-events) Much...
And now for something completely different... In exploring how to address the issues in py-event attributes, I took a detour and ended up somewhere interesting. There are 4 core issues:...
Window.event is deprecated but it has very wide support and its removal would break the web. The @handler( event="click" ) decorator uses addEventListener internally so this essentially aligns with how...
I love the idea of `` attributes to define main/web-worker/sync/async behavior of script content. As to the names/api/behavior... that will take some time to define. This is an important use...
Thought sample... 🤔 ```html < ! ╌ defaults to main + sync ╌> < ! ╌ defaults to main + async ╌> < ! ╌ defaults to worker + sync...
+1 on umbrella ticket The issue looks to be having legal html in an inner string and these entities were parsed by the browser as inner elements. Note the behavior...
Within the py-script element, we do this ```js this.code = htmlDecode(this.innerHTML); ``` where htmlDecode looks like this ```js function htmlDecode(input: string): string { const doc = new DOMParser().parseFromString(ltrim(escape(input)), 'text/html'); return...
Not doomed... someone pushed all code through a DOMParser here: https://github.com/pyscript/pyscript/blob/main/pyscriptjs/src/utils.ts#L18
The PyScript custom element could extend HTMLPreElement. This element preserves all whitespace and formatting of child text, which should void the implied HTML parsing. On Wed, Nov 2, 2022 at...