>> if an attribute
>> that is being rendered by a variable that is null/doesn't exist is removed
>> from the DOM?
Yes, although technically "doesn't exist" is impossible in java, your
${bodyClass} property will always exist, it just might evaluate to
null.


Tapestry builds a proprietary DOM representation of your page before
it renders it. If you have a null value for an attribute it isn't
added and so it's not rendered.

Here's the javadoc for the attribute method used to add attributes to the DOM.

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/dom/Element.html#attribute(java.lang.String,
java.lang.String)

Parameters:
name - the name of the attribute to add
value - the value for the attribute. A value of null is allowed, and
no attribute will be added to the element.


Josh

On Wed, Jan 18, 2012 at 4:22 PM, Thiago H. de Paula Figueiredo
<thiag...@gmail.com> wrote:
> On Wed, 18 Jan 2012 21:17:27 -0200, yazdog8 <j...@paulsenweb.com> wrote:
>
>> In the layout template tml, I have this:
>> <body id="${bodyid}" class="${bodyClass}"></body>
>> What I'm seeing on runtime is that if there is no ID set, the id attribute
>> on the html body tag isn't rendered. Likewise, for the class attribute. Is
>> this the expected behavior? Something along the lines that if an attribute
>> that is being rendered by a variable that is null/doesn't exist is removed
>> from the DOM?
>
>
> No.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to