tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Holmes <r...@hyperstep.com>
Subject [T4] If/Else/For tag rendering behavior
Date Sun, 28 Jan 2007 22:58:08 GMT
This subject has come up in the past with no real conclusion, but it  
did seem like there was consensus on at least one point. Namely, that  
an If/Else/For component should automatically emulate its template  
tag if the tag is anything other than a span or div (i.e. tag- 
dependent rendering/emulation).

I started working on a patch to implement this (thinking it might  
help to at least push the discussion forward) but quickly ran into a  
problem with the renderTag parameter.

If certain template tags render by default and others do not, the  
meaning of the renderTag parameter becomes unclear. For instance,  
what should happen if renderTag=true but the template tag is a span?  
If the answer is that renderTag should take precedence, then we're  
back to having to explicitly set renderTag every time we want a "pure  
logic" If/Else/For (assuming renderTag defaults to true). If the tag- 
dependent behavior takes precedence then renderTag is ignored in one  
case or the other. Either renderTag=false is ignored for non-span/div  
tags or renderTag=true is ignored for spans and divs.

The renderTags configuration property seems to only complicate the  
situation. It either overrides and interferes with the tag-dependent  
behavior or gets re-interpreted as "turn on tag-dependent behavior",  
which leads back to the ambiguous renderTag=false case mentioned above.

So here's what I have in mind at the moment: implement the tag- 
dependent behavior, remove the renderTag parameter and the renderTags  
property and un-deprecate the element parameter to handle edge cases  
(e.g. you want a span or div to render or you want to emulate a  
different tag than what's in the template). This should give us the  
correct default behavior in most cases and provide an unambiguous way  
to override that behavior (via the element parameter).

What I'm advocating is clearly a "convention over configuration"  
approach that might not be to everyone's taste, but it does have the  
advantages of being convenient, consistent (you don't have to think  
about how your component will behave with renderTags=false, etc.),  
relatively simple and more backwards compatible with 4.0 than the  
current behavior.

Thoughts?

-Ryan



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message