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

Jan-Kees van Andel commented on MYFACES-2585:
---------------------------------------------

I'm just looking at it from the side, but isn't the issue that there is some 
fixed CDATA block (the outermost one), which may contain arbitrary HTML 
(possibly containing CDATA blocks)?

There's nothing wrong with the CDATA on itself. It goes wrong when it's being 
marshalled another CDATA block. So that's where I would put (the first part of) 
the fix.
For example, by overriding (if allowed by the TCK) the write() method in 
PartialResponseWriter to encode the CDATA end tag in some way.
When encoded, the JavaScript only needs to decode all content in the CDATA 
blocks.
If conform spec, it should be compatible with Mojarra and frameworks should not 
see any difference.

Any nesting deeper than one level is an error of the developer/component-author 
and I don't think we should anticipate on this.

So actually I'm saying we need to do any encoding exactly at the point where 
the content is being written to the response. Before is impossible, after is 
cumbersome.

The write() method could also be put into the impl, but I think it then needs 
to become smarter, containing some state whether or not the content needs to be 
encoded. Overriding write() in PartialResponseWriter is possibly the easiest 
approach since you can assume all content needs to be encoded.

But again, I'm just looking at it from the sideline and I might not see all 
details here. Just trying to look at it from a fresh angle. ;-)

> 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