Closed jsonberry closed 1 year ago
Early investigation looks like this could be related to some checks on NODE_TYPE
Still very early on in the research, it's my first time checkin' out the source.
Just a guess here but changing the mime type to text/css
and entirely skipping <style />
in response be any help if its checking for NODE_TYPE
?
This bug also occurs if <style>
is the first in a list of sibling nodes like this:
<style>.not-rendered {}</style>
<div></div>
But not if it's second or third or last:
<div></div>
<style>.rendered-just-fine {}</style>
Or if it's wrapped in another element:
<div>
<style>.rendered-just-fine {}</style>
</div>
Does this behave differently if htmx.config.useTemplateFragments
config is true?
Maybe related? https://github.com/bigskysoftware/htmx/pull/1768
Yeah, #1768 fixes this from what I can see (I just deleted the stuff from the .html files, added a
to one, like in https://github.com/bigskysoftware/htmx/issues/1771#issuecomment-1711140665, and then tried it out by clicking around)
Does this behave differently if
htmx.config.useTemplateFragments
config is true?
<script>htmx.config.useTemplateFragments = true; </script>
fixed it just like you suggested... thanks
I think this issue will also benefit from https://github.com/bigskysoftware/htmx/pull/1794
Resolved by #1768
htmx version: 1.9.5
Here's a barebones example for when I attempt to get a
style
tag as the main node it does not appear in the DOM.I've tried various techniques and nothing has worked so far. There is one workaround listed below.
I suspect
htmx
treatsstyle
special because I've noticed that it will insert astyle
tag into thehead
on load, maybe there's something funky going on there.Setup
Expected
<button>
to be replaced with<style>
Actual
Workaround
Wrap the
<style>
in any other tag and the node will populate:Results in: