Michael, that won't work, because in this case CDATA is just a handy tool
to allow XML parser to encode special characters as entities himself
without you to manually converting > to >

You can test it yourself:

<script>

//<![CDATA[


var a = 0;

if (a < 1) { alert('a < 1'); } else { alert('a >= 1'); }


//]]>

</script>

This will result in:

<script>
//

var a = 0;
if (a &lt; 1) { alert('a &lt; 1'); } else { alert('a &gt;= 1'); }

//</script>

But I actually like this side effect with JavaScript, because it forces me
to separate presentation (TML) and logic (JS), which I believe is good.


On Fri, Sep 27, 2013 at 6:44 PM, Michael <gagau...@gmail.com> wrote:

> <script>
> //<!--
>
> //Any code, any characters
>
> //-->
> </script>
>
> <script>
> //<![CDATA[
>
> //Any code, any characters
>
> //]]>
> </script>
>
> But you won't be able to use ${vars} in this sections.
>
>
> 27.09.2013 18:38, Dmitry Gusev пишет:
>
>  I'm always having issues with these characters when I try to put
>> JavaScript
>> logic, like for (var i = 0; i<  10; i++) or if (a>b) {}.
>> I haven't found better approach than moving this code out of template to
>> external *.js files.
>>
>>
>> On Fri, Sep 27, 2013 at 6:08 PM, Barry Books<trs...@gmail.com>  wrote:
>>
>>  Is there any way to but a>  sign in a dynamic template and have it
>>> rendered
>>> as '>'. I end up with'&gt;' which is not what I want. I know the
>>> suggestion for tml files is to use outputRaw but that does not work in a
>>> dynamic template.
>>>
>>> Thanks
>>> Barry
>>>
>>>
>>
>>
> --
> Best regards,
> Michael Gagauz
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Reply via email to