white-motorcycle-95262
01/07/2022, 12:59 AMfresh-controller-36545
01/07/2022, 12:59 AMcss
and js
, depending on what caching policy you configured on your static-files-hosting-webserver.fresh-controller-36545
01/07/2022, 12:59 AMhx-boost
only selects the body
anyways afaikfresh-controller-36545
01/07/2022, 12:59 AMwhite-motorcycle-95262
01/07/2022, 12:59 AMbody
but 🤷fresh-controller-36545
01/07/2022, 1:01 AMhx-boost
like so:
html
<body>
<!-- navbar etc-->
<div id="main-body-wrapper"
hx-boost="true"
hx-select="#main-content"
hx-target="#main-content"
hx-swap="outerHTML show:window:top"
hx-push-url="true"
hx-inherit="false">
<div id="main-content">[content]</div>
</div>
<!-- other stuff -->
</body>
fresh-controller-36545
01/07/2022, 1:02 AMhx-inherit
as a new attribute @User is currently looking intowhite-motorcycle-95262
01/07/2022, 1:05 AMwhite-motorcycle-95262
01/07/2022, 1:06 AMfresh-controller-36545
01/07/2022, 1:08 AMwhite-motorcycle-95262
01/07/2022, 1:10 AMmain-body-wrapper
won't automatically have, e.g., hx-push-url
set to true?fresh-controller-36545
01/07/2022, 1:10 AMwhite-motorcycle-95262
01/07/2022, 1:11 AMfresh-controller-36545
01/07/2022, 1:13 AMhx-boosted
kinda forces the url to be pushed. It's more that children htmx elements defining their own HTMX-logic would otherwise have e.g. hx-select
Consider this HTML:
html
<div id="main-body-wrapper"
hx-boost="true"
hx-select="#main-content"
hx-target="#main-content"
hx-swap="outerHTML show:window:top"
hx-push-url="true"
hx-inherit="false">
<div id="main-content">
<span hx-get="/test/" hx-target="this">Click me</span>
</div>
</div>
The span
would automatically inherit hx-select
, which – if #main-content
is not present in the HTML the /test/
endpoint returns – results in an empty span
fresh-controller-36545
01/07/2022, 1:13 AMwhite-motorcycle-95262
01/07/2022, 1:16 AMhx-select
(just discovered the lib this week). So the response would still be the entire page/template, but hx-select
would just swap the relevant portion 👍white-motorcycle-95262
01/07/2022, 1:16 AMfresh-controller-36545
01/07/2022, 1:17 AMmammoth-family-48524
01/08/2022, 10:04 AMhundreds-camera-24900
01/08/2022, 2:52 PMhundreds-camera-24900
01/08/2022, 2:52 PMlemon-battery-11524
01/08/2022, 6:08 PMlemon-battery-11524
01/08/2022, 6:09 PMfresh-controller-36545
01/08/2022, 7:34 PMfresh-controller-36545
01/08/2022, 7:35 PMlemon-battery-11524
01/08/2022, 8:35 PMlemon-battery-11524
01/08/2022, 8:46 PMfresh-controller-36545
01/08/2022, 8:59 PMdjango
<div id="messages">
{% spaceless %}
{% if messages %}
{% if message.level != DEFAULT_MESSAGE_LEVELS.SUCCESS %}{% endif %}
{% endif %}
{% endspaceless %}
</div>
mammoth-family-48524
01/09/2022, 10:07 AMbillions-easter-81130
01/09/2022, 2:10 PM