Support » Fixing WordPress » v 4.2.3: linebrake behind CDATA lost, JavaScript not processing

  • After embedding the call of a JavaScript function into a post/page the Text view of the editor shows:

    <script type="text/javascript">// <![CDATA[
    myFunction();
    // ]]></script>

    When calling this page by its URL its HTML code looks like that since today – 23 July 2015:

    <script type="text/javascript">// <![CDATA[  myFunction();  // ]]></script>

    … all in a single line. And the JavaScript function is not called.

    Saving the HTML code as static page and inserting a line break before myFunction() solves the problem, the function is called again.

    And this problem comes up with all pages having JavaScript embedded this way – all of them are drop dead now – without having edited any of them since days.

    As the only change to the WordPress system was the update to 4.2.3. last night we are quite sure that this version starts flattening embedded CDATA code.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Same problem here, though the workaround I found was to change from using line comments “//” to comment block “/* */” and all is good.

    e.g. OLD code

    <script type="text/javascript">// <![CDATA[
    myFunction();
    // ]]></script>

    NEW code

    <script type="text/javascript">/* <![CDATA[ */
    myFunction();
    /* ]]> */ </script>

    Don’t work in all case. In my code this:

    sParameterName[0]

    is change as:

    sParameterName[0&#093

    As a result the code is wrong.

    This ticket sounds promising.
    Thanks Robert

    I am getting this error in 4.1.6 suddenly.
    This

    <script>// <![CDATA[
    alert(‘hello’);
    //]]>
    </script>

    gets converted to

    // <![CDATA[ alert(‘hello’); // ]]>

    and the js code doesnt execute. I had an embedded twitter feed in my site which has stopped working because of this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘v 4.2.3: linebrake behind CDATA lost, JavaScript not processing’ is closed to new replies.