mysterious-toddler-20573
05/19/2021, 4:57 PMmysterious-toddler-20573
05/19/2021, 4:58 PMmysterious-toddler-20573
05/19/2021, 4:59 PMgorgeous-ghost-95789
05/19/2021, 5:00 PMhtmx.legacyBrowsers flag that's used in several places. revealed would be another candidate.mysterious-toddler-20573
05/19/2021, 5:00 PMadamant-exabyte-92636
05/19/2021, 5:03 PMmysterious-toddler-20573
05/19/2021, 5:08 PMastonishing-flag-36727
05/19/2021, 6:04 PMproud-dentist-32878
05/19/2021, 8:53 PMmysterious-toddler-20573
05/19/2021, 9:07 PMhx-js-action and hx-hs-action for javascript and hyperscriptproud-dentist-32878
05/19/2021, 10:00 PMhx-js-action and hx-hs-action, wouldn't that make htmx integrate too deeply with hyperscript? I think I like the idea of htmx being actually like an extension to html, and it would be nice to have an hx-action that feels a lot like onClick or onChange html attributes.
But i see your point. Especially for hyperscript, the ergonomics of calling hyperscript inline via an interop funcion is not great. How about having hx-action that defaults to js, and then hx-hs-action that works with hyperscript?
Or having 2 attributes; hx-action , and hx-script. hx-action would be either js or hs, or any future script, and then hx-script would be either js or hs or any future script, and when not set, defaults to javascript?
There's also the option of only defining the hyperscript actions in a script tag, and only calling the hyperscript functins via the interop. eg
html
<script type="text/hyperscript">
function doStuff()
put "abc" into #btnID.innerHTML then
toggle .hidden on #modal
end
</script>
<button hx-trigger="click[metaKey]" hx-action="_hyperscript.evaluate(doStuff())">close</button> The interop can also be aliased to something like action="_hs.e(doStuff())"
I'm not sure which option is best. Though I would lean more towards hx-action , and hx-script or just supporting only javascript and interop.
Sorry for the lengthy write up.mysterious-toddler-20573
05/19/2021, 10:01 PMproud-dentist-32878
05/19/2021, 10:13 PMjs
{
onEvent : function(name, evt) {return true;},
transformResponse : function(text, xhr, elt) {return text;},
isInlineSwap : function(swapStyle) {return false;},
handleSwap : function(swapStyle, target, fragment, settleInfo) {return false;},
encodeParameters : function(xhr, parameters, elt) {return null;}
}mysterious-toddler-20573
05/19/2021, 10:17 PMhtmx:load event and wire in your stuff there, one secmysterious-toddler-20573
05/19/2021, 10:17 PMmysterious-toddler-20573
05/19/2021, 10:17 PMmysterious-toddler-20573
05/19/2021, 10:18 PMhtmx:afterProcessNode event might be the right thingmysterious-toddler-20573
05/19/2021, 10:18 PMmysterious-toddler-20573
05/19/2021, 10:18 PMproud-dentist-32878
05/19/2021, 10:33 PMmysterious-toddler-20573
05/20/2021, 6:30 PMmysterious-toddler-20573
05/20/2021, 6:30 PMmysterious-toddler-20573
05/20/2021, 6:36 PMmysterious-toddler-20573
05/20/2021, 8:35 PMmysterious-toddler-20573
05/20/2021, 8:35 PMplain-kangaroo-26043
05/20/2021, 9:11 PMplain-kangaroo-26043
05/20/2021, 9:12 PMplain-kangaroo-26043
05/20/2021, 9:12 PMplain-kangaroo-26043
05/20/2021, 9:14 PM