You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Johan Compagner <jc...@gmail.com> on 2007/11/07 17:00:03 UTC

escaping/commenting scripts in the wicket:head tag..

Hi,

When i do this in a panels html:

<html>
<wicket:head>
<script>
function test()
{
        var x = 10;
       if (x < 10 && x > 10) {}
}
</script>
</wicket:head>
<body>
<wicket:panel>body</wicket:panel>
</body>
</html>

then with normal rendering it works fine no problem
But if i then render it through ajax we suddenly have a problem in IE
because it sees < or > because somehow it parses to script.

so we have to do this:

 <html>
<wicket:head>
<script>
<!--/*--><![CDATA[/*><!--*/
function test()
{
        var x = 10;
       if (x < 10 && x > 10) {}
}
/*-->]]>*/
</script>
</wicket:head>
<body>
<wicket:panel>body</wicket:panel>
</body>
</html>

then it works, This is a bit annoying that you have to do that by yourself.
So would it be possible to do this for them when we do the markup parsing?

johan

Re: escaping/commenting scripts in the wicket:head tag..

Posted by Juergen Donnerstag <ju...@gmail.com>.
May I suggest you open a jira feature request. I don't mind looking
into it provided it doesn't need to be ready by tomorrow.

Juergen

Re: escaping/commenting scripts in the wicket:head tag..

Posted by Matej Knopp <ma...@gmail.com>.
I wouldn't mind, as long as we check whether the script doesn't
already include [CDATA[ section.

-Matej

On 11/7/07, Johan Compagner <jc...@gmail.com> wrote:
> Hi,
>
> When i do this in a panels html:
>
> <html>
> <wicket:head>
> <script>
> function test()
> {
>         var x = 10;
>        if (x < 10 && x > 10) {}
> }
> </script>
> </wicket:head>
> <body>
> <wicket:panel>body</wicket:panel>
> </body>
> </html>
>
> then with normal rendering it works fine no problem
> But if i then render it through ajax we suddenly have a problem in IE
> because it sees < or > because somehow it parses to script.
>
> so we have to do this:
>
>  <html>
> <wicket:head>
> <script>
> <!--/*--><![CDATA[/*><!--*/
> function test()
> {
>         var x = 10;
>        if (x < 10 && x > 10) {}
> }
> /*-->]]>*/
> </script>
> </wicket:head>
> <body>
> <wicket:panel>body</wicket:panel>
> </body>
> </html>
>
> then it works, This is a bit annoying that you have to do that by yourself.
> So would it be possible to do this for them when we do the markup parsing?
>
> johan
>