[wp-trac] [WordPress Trac] #42972: XHTML CDATA compliance regression in preview script

WordPress Trac noreply at wordpress.org
Sun Dec 24 01:52:19 UTC 2017


#42972: XHTML CDATA compliance regression in preview script
------------------------------+-----------------------------
 Reporter:  sephr             |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Revisions         |    Version:  4.9.1
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 The following script is injected on post preview pages without CDATA for
 XHTML compliance. I remember this issue being fixed a few years ago, and
 it has regressed.


 {{{
         <script>
         ( function() {
                 var query = document.location.search;

                 if ( query && query.indexOf( 'preview=true' ) !== -1 ) {
                         window.name = 'wp-preview-530';
                 }

                 if ( window.addEventListener ) {
                         window.addEventListener( 'unload', function() {
 window.name = ''; }, false );
                 }
         }());
         </script>
 }}}

 The script needs /*<![CDATA[*/ at the start and /*]]>*/ at the end to fix
 rendering errors when served as application/xhtml+xml.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42972>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list