[wp-trac] [WordPress Trac] #34760: TinyMCE adds additional ul tags if successive list items contain script tags

WordPress Trac noreply at wordpress.org
Sat Nov 21 11:30:35 UTC 2015


#34760: TinyMCE adds additional ul tags if successive list items contain script
tags
----------------------------+-----------------------------
 Reporter:  modernnerd      |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  TinyMCE         |    Version:  4.3.1
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 TinyMCE duplicates unordered lists when toggling between Text and Visual
 mode if two successive list items contain script tags.

 === To reproduce:

 Tested in Chrome 46.0.2490.86 / Mac OS 10.11.1

 1. Paste the following sample HTML in Text mode:

 {{{
 <ul>
         <li>Test 1<script
 src="http://example.com/notfound.js"></script></li>
 </ul>

 <ul>
         <li>Test 2<script
 src="http://example.com/notfound.js"></script></li>
 </ul>
 }}}

 This HTML will also generate the same unexpected result shown below:

 {{{
 <ul>
         <li>Test 1<script
 src="http://example.com/notfound.js"></script></li>
         <li>Test 2<script
 src="http://example.com/notfound.js"></script></li>
 </ul>
 }}}

 2. Switch to visual mode and back to text mode again.

 === Expected result:

 {{{
 <ul>
         <li>Test 1<script
 src="http://example.com/notfound.js"></script></li>
 </ul>

  

 <ul>
         <li>Test 2<script
 src="http://example.com/notfound.js"></script></li>
 </ul>
 }}}

 === Actual result:

 {{{
 <ul>
 <ul>
         <li>Test 1<script
 src="http://example.com/notfound.js"></script></li>
 </ul>
 </ul>

  

 <ul>
         <li>Test 2<script
 src="http://example.com/notfound.js"></script></li>
 </ul>
 }}}

 The first list's ul tags become doubled in the case of the first HTML
 sample supplied. With the second sample, the two list items are split into
 two unordered lists, and the first list's ul tags are doubled.

 Each time you switch from Text to Visual mode, the first list gains an
 extra pair of ul tags.

 Scripts inside list items are valid HTML: http://www.w3.org/TR/html5
 /grouping-content.html#the-li-element. (Note “content model: flow
 content”. Flow content includes the script tag:
 http://www.w3.org/TR/html5/dom.html#flow-content-1.)

 The most common reason I've seen for users to include script tags in list
 items is to embed a GitHub Gist.

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


More information about the wp-trac mailing list