astonishing-oil-69230
01/20/2022, 7:35 PMastonishing-oil-69230
01/20/2022, 7:37 PMfresh-controller-36545
01/20/2022, 7:51 PMlate-king-98305
01/20/2022, 8:02 PMnarrow-room-51024
01/20/2022, 8:23 PMastonishing-oil-69230
01/20/2022, 8:24 PMwhite-motorcycle-95262
01/20/2022, 9:24 PM<style> elements? 😐
EDIT: It looks like HTMX works if the first tag of the response is not a <style> tag (i.e., there's an OOB tag before it), but doesn't seem to work properly otherwise. 🤷blue-gold-89534
01/20/2022, 9:35 PMhtml
<style>
tr.htmx-settling {
opacity: 0;
transition: opacity 1s ease-in;
}
</style>
<table>
<caption>
<img id="showInfo"
src="..."
hx-get="..."
hx-swap="outerHTML settle:1s"
hx-target="#info"> ...
</caption>
<thead>
<tr id="info"></tr>
</thead>
<tbody>...</tbody>
</table>
this settles in, but without the animation. Can someone tell me why 🙂astonishing-oil-69230
01/20/2022, 11:21 PMpython
import jinja2
from jinja2 import Environment, BaseLoader
def str_render(tmpl, **context):
template = Environment(loader=BaseLoader).from_string(tmpl)
return template.render(**context)
def file2str(path):
return open(path).read()
class Component:
tmpl_path = None
tmpl = None
def __new__(cls, **kw):
cls._kw = kw
return cls._render()
@classmethod
def _render(cls):
if cls.tmpl_path:
tmpl = file2str(cls.tmpl_path)
if cls.tmpl:
tmpl = cls.tmpl
fn = getattr(cls, 'render', None)
if fn:
tmpl = fn(**cls._kw)
return str_render(tmpl, **cls._kw)
class Div(Component):
tmpl = '<div>{{content}}</div>'
class TextField(Component):
tmpl_path = 'templates/form/textfield.html'
class App(Component):
@classmethod
def render(cls, **kw):
ret = ''
for i in range(100):
ret += f'<div>{{data_{i+1}}}</div>\n'
return ret
print(Div(content='test'))
print(App())mysterious-toddler-20573
01/21/2022, 1:54 AMmysterious-toddler-20573
01/21/2022, 1:54 AMmysterious-toddler-20573
01/21/2022, 1:56 AMwhite-motorcycle-95262
01/21/2022, 2:31 AMwhite-motorcycle-95262
01/21/2022, 2:32 AMmysterious-toddler-20573
01/21/2022, 4:08 AMmysterious-toddler-20573
01/21/2022, 4:08 AMwhite-motorcycle-95262
01/21/2022, 4:09 AMmysterious-toddler-20573
01/21/2022, 4:16 AMmysterious-toddler-20573
01/21/2022, 4:16 AMwhite-motorcycle-95262
01/21/2022, 4:19 AMmysterious-toddler-20573
01/21/2022, 4:37 AMmysterious-toddler-20573
01/21/2022, 4:37 AMmysterious-toddler-20573
01/21/2022, 4:37 AMbulky-lighter-31557
01/21/2022, 7:45 AMbumpy-zoo-26881
01/21/2022, 1:34 PMancient-rose-1570
01/21/2022, 1:50 PMmysterious-toddler-20573
01/21/2022, 1:50 PMred-farmer-97020
01/21/2022, 2:12 PMmysterious-toddler-20573
01/21/2022, 2:13 PMred-farmer-97020
01/21/2022, 2:14 PM