[TYPO3-core] FYI48: #12899: Wrong usage of CDATA raise javascript error

Steffen Kamper info at sk-typo3.de
Thu Dec 3 12:41:46 CET 2009


Hi Ernesto,

Ernesto Baschny [cron IT] schrieb:
> Steffen Kamper schrieb:
> 
>> This is an SVN patch request.
>>
>> Type: bugfix
>>
>> BT reference: http://bugs.typo3.org/view.php?id=12899
>>
>> Branches: trunk, 4_3
>>
>> in t3lib_tsStyleConfig::ext_getForm the CDATA is
>> * not commented out which raise a javascript error
>> * have wrong closing tag
>>
>> This javascript tag is used in EM with info view of extension.
> 
> Which browser will rise this error? Commenting it out the way you did
> it: won't this make it non-xhtml anymore?
> 
> As far as I researched, the best way to escape the cdata without caring
> about "legacy browser" that don't interpret javascript at all is:
> 
> starting line: <!--//--><![CDATA[
> ending line: //]]>
> 
> See [1] for a "full explanation". As soon as we find the "best way" to
> handle this, we should add this to the CGL so that everybody knows how
> to do it. Or even better instead of adding the escaping every time, call
> the API function t3lib_div::wrapJS() and we can then later centrally
> adapt it to our needs.
> 


seems you confuse this with CDATA in other context. In Javascript CDATA 
simply is commented out. Same way it's done with any inline JS in TYPO3, 
just look to any source of BE or FE

vg Steffen


More information about the TYPO3-team-core mailing list