[
https://issues.apache.org/jira/browse/MYFACES-2585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841456#action_12841456
]
Ganesh Jung commented on MYFACES-2585:
--------------------------------------
Hi Werner,
I agree that the Mojarra's way of handling CDATA isn't mind-boggling. Still the
approach of just removing the enclosing CDATA may be a way to go. Sure enough,
removing *every* CDATA is just plain wrong and it's due to Mojarra's RE
approach.
Why is there CDATA around scripts? It's because otherwise the XHTML becomes
invalid with &&, || and other special characters. But, with xhr the browsers
accept these scripts *without* CDATA, so this one works with Mojarra:
<h:inputText value="#{myBean.test}">
<f:ajax render="test" />
</h:inputText>
<h:panelGroup id="test">
<script type="text/javascript">
//<![CDATA[
alert(0&&1 ? "running" : "not running");
//]]>
</script>
<h:inputText value="#{myBean.test}" />
</h:panelGroup>
while this one is rejected by the facelets parser:
<h:inputText value="#{myBean.test}">
<f:ajax render="test" />
</h:inputText>
<h:panelGroup id="test">
<script type="text/javascript">
alert(0&&1 ? "running" : "not running");
</script>
<h:inputText value="#{myBean.test}" />
</h:panelGroup>
So, removing the CDATA doesn't harm when doing XHR. It's just that it should be
done *correctly* which is not the case for Mojarra. What do you think, couldn't
we go this way?
Best regards,
Ganesh
> ajax doesn't work if target contains script with CDATA
> ------------------------------------------------------
>
> Key: MYFACES-2585
> URL: https://issues.apache.org/jira/browse/MYFACES-2585
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Affects Versions: 2.0.0-beta-2
> Environment: Javascript, API, IMPL...
> Reporter: Ganesh Jung
> Priority: Critical
>
> This doesn't work:
> <h:inputText value="#{numberBean.myNumber}">
> <f:ajax render="test" />
> </h:inputText>
> <h:panelGroup id="test">
> <script type="text/javascript">
> //<![CDATA[
> alert("running");
> //]]>
> </script>
> <h:inputText value="#{numberBean.myNumber}" />
> </h:panelGroup>
> But this works fine:
> <h:inputText value="#{numberBean.myNumber}">
> <f:ajax render="test" />
> </h:inputText>
> <h:panelGroup id="test">
> <script type="text/javascript">
> alert("running");
> </script>
> <h:inputText value="#{numberBean.myNumber}" />
> </h:panelGroup>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.