[ 
https://issues.apache.org/jira/browse/MYFACES-2585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841267#action_12841267
 ] 

Werner Punz edited comment on MYFACES-2585 at 3/4/10 2:11 PM:
--------------------------------------------------------------

Ok I gave mojarra a blackbox testrun, and they also got it wrong, but in a 
different area
 <script type="text/javascript">
        //<![CDATA[
                    alert("hello");
        //]]>
</script>
Works mojarra filters the cdata blocks out and then pushes the result in

but
 <script type="text/javascript">
                    alert("<![CDATA[hello]]>");
</script>
Fails miserably... with following result:

<?xml version="1.0" encoding="utf-8"?>
<partial-response><changes><update id="myForm:myText"><![CDATA[<span 
id="myForm:myText"><input type="text" name="myForm:j_idt9" />
                <script type="text/javascript">
                    alert("<![CDATA[hello]]>");
                                </script></span>]]></update><update 
id="javax.faces.ViewState"><![CDATA[6828064334725830407:2895691425126613358]]></update></changes></partial-response>

the second cdata block causes the xml response parser on the xhr object to 
choke (which also happens probably
in our case.)

I think the cleanest solutuon would be in all cases to to a post scan for a 
CDATA string and if present
simply encode the entire update part with a prefix. I will bring this to the 
open list!



      was (Author: werpu):
    Ok I gave mojarra a blackbox testrun, and they also got it wrong, but in a 
different area
 <script type="text/javascript">
        //<![CDATA[
                    alert("hello");
        //]]>
</script>
Works mojarra filters the cdata blocks out and then pushes the result in

but
 <script type="text/javascript">
                    alert("<![CDATA[hello]]>");
</script>
Fails miserably... I assume from the behavior they applied a bunch of regular 
expressions instead of trying to do a clean
resolution of the problem.

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

Reply via email to