You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been tasked with trying to figure out why templates rendered using Chameleon < 3.8.0 render differently semantically than templates rendered under 3.8.0 and greater.
I was pointed at Pylons/pyramid_chameleon#31 which sorta.. kinda? describes the problem, but not fully. The diagnosis reached within that issue was for pyramid_chameleon to use a boolean_attributes argument to PageTemplate but I am afraid to report that this doesn't actually solve the problem.
The issue is with (braindead) HTML attributes which can valueless like "checked", "selected", etc, and whose mere presence indicates that they are true (their value is ignored).
Below I'm going to repeat the findings I came up with in Pylons/pyramid_chameleon#31 (comment) which explain the problem in depth. TLDR: when boolean_attributes is used, rendering one of those braindead attributes works properly when it is replaced using tal:attributes but not when it is replaced using squiggly brace syntax. If someone can point me at the code that I might should change in Chameleon to fix this, I would be grateful, because this behavior change causes fifteen years of templates to need to be reviewed and changed, which is too much work to ponder.
Anyway....
Here's a program that renders several templates. Some should be detected as
HTML by Chameleon, some as XML, and their output should probably differ based
on whether Chameleon believes they are HTML or XML (spoiler alert: they don't).
Each uses the tal:attribute spelling and the inline curly brace spelling to
replace a checked attribute.
Note that under 3.7.4 when "checked" is False, the checked attribute is
left off the element, even under the XML case (where it presumably should not
be), no matter whether we use tal:attributes or a curly brace statement to
represent "checked".
Under 3.8 (and master), the "checked" attribute is only left off when we use tal:attributes.
The text was updated successfully, but these errors were encountered:
I have been tasked with trying to figure out why templates rendered using Chameleon < 3.8.0 render differently semantically than templates rendered under 3.8.0 and greater.
I was pointed at Pylons/pyramid_chameleon#31 which sorta.. kinda? describes the problem, but not fully. The diagnosis reached within that issue was for
pyramid_chameleon
to use aboolean_attributes
argument to PageTemplate but I am afraid to report that this doesn't actually solve the problem.The issue is with (braindead) HTML attributes which can valueless like "checked", "selected", etc, and whose mere presence indicates that they are true (their value is ignored).
Below I'm going to repeat the findings I came up with in Pylons/pyramid_chameleon#31 (comment) which explain the problem in depth. TLDR: when
boolean_attributes
is used, rendering one of those braindead attributes works properly when it is replaced usingtal:attributes
but not when it is replaced using squiggly brace syntax. If someone can point me at the code that I might should change in Chameleon to fix this, I would be grateful, because this behavior change causes fifteen years of templates to need to be reviewed and changed, which is too much work to ponder.Anyway....
Here's a program that renders several templates. Some should be detected as
HTML by Chameleon, some as XML, and their output should probably differ based
on whether Chameleon believes they are HTML or XML (spoiler alert: they don't).
Each uses the tal:attribute spelling and the inline curly brace spelling to
replace a checked attribute.
Here's the output of that program using Chameleon 3.7.4:
Here's the output of the same program under Chameleon 3.8.0:
Note that under 3.7.4 when "checked" is False, the
checked
attribute isleft off the element, even under the XML case (where it presumably should not
be), no matter whether we use tal:attributes or a curly brace statement to
represent "checked".
Under 3.8 (and master), the "checked" attribute is only left off when we use tal:attributes.
The text was updated successfully, but these errors were encountered: