You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Richard Hill <ri...@su3analytics.com> on 2010/10/07 18:21:31 UTC
Inline javascript "<" being rendered as a character entity "<"
Hi All,
I have a small javascript function that ideally I'd like to include
inline in my page:
<script type="text/javascript">
<![CDATA[
function check(element) {
...snip...
for (var i; i < nodes.length; i++) {
}
etc...
}
]]>
</script>
Now the "less than" is being rendered as an xml character entity - which
obviously breaks the javascript.
I understood from various discussions that enclosing the function in a
CDATA block would mean it's rendered as character data - or have I
misunderstood?
This is in a component, the top of my .tml has:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<div id="configure" xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
Any help much appreciated!
Thanks Richard.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Inline javascript "<" being rendered as a character entity "<"
Posted by Pablo dos Reis <pa...@gmail.com>.
Good!!!
tks Richard
2010/10/7 Richard Hill <ri...@su3analytics.com>
>
> To answer my own question, this appears to work:
>
> <script type="text/javascript">
> // <!--\n
> ...snip...
> // -->
> </script>
>
>
> R.
>
>
> -----Original Message-----
> From: Richard Hill <ri...@su3analytics.com>
> Reply-to: rich@su3analytics.com
> To: Tapestry users <us...@tapestry.apache.org>
> Subject: Inline javascript "<" being rendered as a character entity
> "<"
> Date: Thu, 07 Oct 2010 17:21:31 +0100
>
> Hi All,
>
> I have a small javascript function that ideally I'd like to include
> inline in my page:
>
> <script type="text/javascript">
> <![CDATA[
> function check(element) {
>
> ...snip...
>
> for (var i; i < nodes.length; i++) {
>
> }
>
> etc...
> }
> ]]>
> </script>
>
>
> Now the "less than" is being rendered as an xml character entity - which
> obviously breaks the javascript.
>
> I understood from various discussions that enclosing the function in a
> CDATA block would mean it's rendered as character data - or have I
> misunderstood?
>
> This is in a component, the top of my .tml has:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <div id="configure" xmlns="http://www.w3.org/1999/xhtml"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>
> Any help much appreciated!
>
> Thanks Richard.
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Pablo Henrique dos Reis
Re: Inline javascript "<" being rendered as a character entity
"<"
Posted by Richard Hill <ri...@su3analytics.com>.
To answer my own question, this appears to work:
<script type="text/javascript">
// <!--\n
...snip...
// -->
</script>
R.
-----Original Message-----
From: Richard Hill <ri...@su3analytics.com>
Reply-to: rich@su3analytics.com
To: Tapestry users <us...@tapestry.apache.org>
Subject: Inline javascript "<" being rendered as a character entity
"<"
Date: Thu, 07 Oct 2010 17:21:31 +0100
Hi All,
I have a small javascript function that ideally I'd like to include
inline in my page:
<script type="text/javascript">
<![CDATA[
function check(element) {
...snip...
for (var i; i < nodes.length; i++) {
}
etc...
}
]]>
</script>
Now the "less than" is being rendered as an xml character entity - which
obviously breaks the javascript.
I understood from various discussions that enclosing the function in a
CDATA block would mean it's rendered as character data - or have I
misunderstood?
This is in a component, the top of my .tml has:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<div id="configure" xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
Any help much appreciated!
Thanks Richard.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org