Issue Bug Closed

#80422TYPO3 8.6.1 mixing FLUID and JS - CDATA doesn't work as before

Thomas Hezel 03/23/17, 16:44 updated 06/06/24, 23:37

Description

This worked until 7.6 but in 8.6.1 CDATA seems to have a different behavior inside a Fluidtemplate.
Inside the CDATA-section {s} and {z} are not escaped but omitted.

<script><br />var lati = {field.lati};<br />var longi = {field.longi}; <br />var map = L.map(&#8216;map&#8217;, {zoomControl: false}).setView([{field.lati}, {field.longi}], 13);</p> <p><![CDATA[<br /> L.tileLayer('http://{s}.tiles.mapbox.com/v3/uhradone.ija63bia/{z}/{x}/{y}.png', {<br /> attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>&#8216;,<br /> maxZoom: 18<br />}).addTo(map);</p> <p>]]&gt;</p> <p></script>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 7

  1. Jan Greth commented 08/25/17, 14:31

    Same Bug occures here in CMS 8.7.4 – Are there any news?

    Thomas Hezel wrote:
    > This worked until 7.6 but in 8.6.1 CDATA seems to have a different behavior inside a Fluidtemplate.
    > Inside the CDATA-section {s} and {z} are not escaped but omitted.
    >
    > <script><br />&gt; var lati = {field.lati};<br />&gt; var longi = {field.longi}; <br />&gt; var map = L.map(&#8216;map&#8217;, {zoomControl: false}).setView([{field.lati}, {field.longi}], 13);<br />&gt; <br />&gt; <br />&gt; <![CDATA[<br />> L.tileLayer(&#8216;<a href="http://{s}.tiles.mapbox.com/v3/uhradone.ija63bia/{z}/{x}/{y}.png&#8217;" target="_blank" rel="noreferrer">http://{s}.tiles.mapbox.com/v3/uhradone.ija63bia/{z}/{x}/{y}.png&#8217;</a>, {<br />&gt; attribution: &#8216;Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>&#8216;,<br />&gt; maxZoom: 18<br />&gt; }).addTo(map); <br />&gt; <br />&gt; <br />&gt; ]]&gt; <br />&gt; <br />&gt; </script>

  2. Benni Mack changed project id TYPO3 Version 8 10/27/17, 17:28

  3. Andreas Kießling commented 01/07/18, 20:20

    I don’t know if the description from Thomas is what i stumpled up on: CDATA blocks are completely omitted from my output.
    AFAIR they were not touched at all in previous versions, which was sometimes needed if the output contains a lot of curly braces and Fluid would choke on it otherwise.

  4. Andreas Kießling commented 01/07/18, 20:22

    Might also be linked to #75138

  5. Susanne Moog changed category 01/24/18, 20:03

  6. Riccardo De Contardi commented 01/31/20, 15:14

    <f:format.cdata> or the instruction {parsing off} can be of help here? (I didn’t test by myself).

  7. Georg Ringer commented and changed status New Closed 06/06/24, 23:37

    Closing this because nothing will change there. Having inline code is bad anyway – I strongly suggest to use data attributes to hand data to JS and have the JS code as external file included.