bigskysoftware/htmx

Update examples (file upload) with hx-on ?

flibustenet opened this issue · 1 comments

Should we update the examples to use hx-on instead of <script> ?
I think of file upload example where we could replace:

<script>
        htmx.on('#form', 'htmx:xhr:progress', function(evt) {
          htmx.find('#progress').setAttribute('value', evt.detail.loaded/evt.detail.total * 100)
        });
</script>

by
hx-on::xhr:progress="htmx.find('#progress').setAttribute('value',event.detail.loaded/event.detail.total * 100)

Then the example use of hyperscript is not more relevant ?

I can send a PR but i still didn't read the guidelines !

Just a question about using inline js in the html tag, Is there any security considerations to think about when moving js out of its script tag?

I read somewhere that onclick inline attribute for a html tag has security vulnerabilities around cross site scripting.

Im not sure, this is just a question I asked myself when reading this. Ill do some research my side and will revert if I find anything.