elegant-london-97728
11/01/2021, 1:32 PMeval by Function throughout htmx as per this info? -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!mysterious-toddler-20573
11/01/2021, 3:01 PMhundreds-camera-24900
11/01/2021, 5:19 PMelegant-london-97728
11/01/2021, 6:06 PMeval I'd need to include unsafe-eval in script-src which would defeat the purpose of CSP. Is there perhaps a way for me to wrap my page's nonce around the script run by hx-trigger when it handles event filters?mysterious-toddler-20573
11/01/2021, 6:11 PMmysterious-toddler-20573
11/01/2021, 6:12 PMhtmx:configRequest event, you can cancel requestsmysterious-toddler-20573
11/01/2021, 6:13 PMelegant-london-97728
11/01/2021, 6:24 PMhx-get to pull data from the server when the tab is activated. In the page header, there is a selector for specializing content to a given field of study, and this selector also triggers the tab contents; however, I want to trigger the tabs' hx-get only for the active tab, so I need to check if the tab is active, which I do with a custom event filtered by custom JS checking if the tab is active. Is there a way to do this more smartly without the event filter? Namely something like hx-trigger="custom-event[check if this tab is active, but no eval called] from:body" or similar?mysterious-toddler-20573
11/01/2021, 6:34 PMjs
htmx.on("htmx:configRequest", function(evt) {
if(evt.target.classList.contains("tab") && evt.target.classList.contains("active")) {
evt.preventDefault();
}
});mysterious-toddler-20573
11/01/2021, 6:35 PMelegant-london-97728
11/01/2021, 6:35 PMelegant-london-97728
11/02/2021, 8:30 AMhtmx.on('htmx:configRequest', evt => {
if (evt.target.closest('div.portal-tab') && !evt.target.closest('div.portal-tab').classList.contains('active')) {
evt.preventDefault();
}
});
but for the triggering element, I have to add a small delay to make sure the tab settles (in my case by bootstrap5) to being marked as active before hx-get runs, e.g. hx-trigger="click delay:200ms from:#reports-tab" . Is there (or could there be) a way to have a trigger wait for another event, like hx-trigger="click after:other-event" ?mysterious-toddler-20573
11/02/2021, 9:33 AMelegant-london-97728
11/02/2021, 9:36 AMgorgeous-ghost-95789
11/02/2021, 5:05 PMclosest keyword in _hyperscript? As in:
on htmx:configRequest(target)
set $tab to the closest <div.portal-tab /> to the target
if $tab.active then
halt default
end
endgorgeous-ghost-95789
11/02/2021, 5:10 PMgorgeous-airport-54386
11/02/2021, 5:20 PMgorgeous-airport-54386
11/02/2021, 5:21 PMgorgeous-ghost-95789
11/02/2021, 5:21 PMgorgeous-ghost-95789
11/02/2021, 5:22 PMhundreds-camera-24900
11/02/2021, 5:22 PMgorgeous-ghost-95789
11/02/2021, 5:22 PMlate-king-98305
11/02/2021, 11:14 PMlate-king-98305
11/02/2021, 11:15 PMmysterious-toddler-20573
11/02/2021, 11:35 PMfreezing-greece-86753
11/03/2021, 10:06 AMfreezing-greece-86753
11/03/2021, 10:07 AMmysterious-toddler-20573
11/03/2021, 12:39 PMenctype declaration on forms. You are probably generating forms w/ an enc-type `mutlipart/form-data`: https://www.w3schools.com/TAGs/att_form_enctype.aspfreezing-greece-86753
11/03/2021, 2:02 PMlate-king-98305
11/03/2021, 4:00 PM