I posted a question about @SupportsInformalParameters to the user list
yesterday but got no useful response. After writing some test cases
its clear to me @SupportsInformalParamters and mixins do not do what
the documentation says. My question is which is wrong the code or the
document?
>From the behavior I'd say the documentation is correct and the code is wrong.
I created a fresh project with 5.3.1 and in Index.tml I have this:
<t:any type="greeting" t:mixins="IP2,IP" ip2.foo="bar2"
ip.foo="bar">${message:greeting}</t:any>
I also created two mixins
@SupportsInformalParameters
public class IP2 {
@Inject
private ComponentResources resources;
@BeginRender
void beginRender(MarkupWriter writer) {
writer.element("IP2");
resources.renderInformalParameters(writer);
}
@AfterRender
void afterRender(MarkupWriter writer) {
writer.end();
}
}
@SupportsInformalParameters
public class IP {
@Inject
private ComponentResources resources;
@BeginRender
void beginRender(MarkupWriter writer) {
writer.element("IP");
resources.renderInformalParameters(writer);
}
@AfterRender
void afterRender(MarkupWriter writer) {
writer.end();
}
}
The output is this
<ip foo="bar" type="greeting">
<ip2 foo="bar2">
<div>Welcome to Tapestry 5! We hope that this project template will
get you going in style.</div>
</ip2>
</ip>
The document says this
If the component and a mixin both define a parameter with the same
name, then the component wins: the component's parameter will be
bound, and the mixin's parameter will be unbound.
I would say in this case type="greeting" belongs on the div node
because the document says the component wins in this case. If not then
where should it be and what should the documentation say? If I reverse
the order of the mixins type="greeting" still ends up on the ip node.
So are the docs wrong, is the code wrong or am I just confused?
Thanks
Barry
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]