>how "safe" is using addScript method of the RenderSupport considering
>old browsers support?
This is not going to affect old browsers, but it *might affect new ones... the 
key point is this:
"No one is using browsers so old as to require this coding for its original 
purpose but many will soon be using web browsers where this coding causes the 
scripts to be commented out completely." I don't know if that will be the case 
but at the moment it seems to be more of a validation problem.

But the article has a valid point, it has become force of habit for me too 
after 10 years of coding JavaScript comments before my scripts in this way, you 
don't think about it after a while you just do it, in truth I have not found a 
solution to accommodate XHTML comments and ordinary comments (as used in 
Tapestry) but this appears to be an elegant solution (actually so simple and 
obvious that it leaves me kicking myself), and it works perfectly in Tapestry 
templates so I think I may change all my comments to use: 
<script type="text/javascript">
/* <![CDATA[ */
// content of your Javascript goes here
/* ]]> */
</script> 

And maybe its something the tapestry devs could investigate?

Thanks for the tip,
Peter

----- Original Message -----
From: "Borut Bolčina" <borut.bolc...@gmail.com>
To: "List Tapestry User" <users@tapestry.apache.org>
Sent: Tuesday, 14 April, 2009 16:27:37 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: RenderSupport addScript old browsers

Hi,

how "safe" is using addScript method of the RenderSupport  considering
old browsers support? Tapestry renders something like:

<script type="text/javascript">
<!--
Tapestry.DEBUG_ENABLED = true;
Tapestry.onDOMLoaded(function() {
urchinTracker();
var pp_gemius_identifier = new
String('dw.rQgdz5MHhw1_2bpPIltTI.IjBDjCvnQC0f_bLGdj.v7');
});
// -->

</script>

when using

    @AfterRender
    public void afterRender() {
            renderSupport.addScript("urchinTracker();");
            renderSupport.addScript("var pp_gemius_identifier = new
String('dw.rQgdz5MHhw1_2bpPIltTI.IjBDjCvnQC0f_bLGdj.v7');");
    }

As per http://javascript.about.com/library/blxhtml.htm there are
several possibilities on how to deal with old browsers.

If any JS expert is reading this, how does the code bellow differ from
what Tapestry renders as shown above? The difference is in the
comments and CDATA.

<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new
String('dw.rQgdz5MHhw1_2bpPIltTI.IjBDjCvnQC0f_bLGdj.v7');
//--><!]]>
</script>


Regards,
Borut

---------------------------------------------------------------------
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