Bug #23645 See Comments

RTE adds unwanted paragraph elements into nested lists

Version: 4.3.1 Reporter: Rick Lecoat

I’ve got some nested lists in an RTE field (the nesting had to be done manually in source mode since the RTE does not provide a button for this). When the entry is saved the RTE arranges the markup (as viewed in its own source view) in its own way — not wrongly (there’s no incorrect tag nesting) but with oddly-chosen line breaks and, in some cases, extra lines between elements. Here is how the source view of the RTE looks:

<ul>
    <li>Students: <ul>
    <li>undergraduate;</li>
    <li>postgraduate;</li>
    <li>students with on campus presence;</li>
    <li>distance learning students, and;</li>
    <li>international students.</li>
</ul>

 </li>
    <li>Staff: <ul>
    <li>academic staff;</li>
    <li>professional support staff;</li>
    <li>senior or VIP staff;</li>
    <li>staff in other service delivery functions of the university for example library or other student support services, and;</li>
    <li>second and third line IT staff.</li>
</ul>

 </li>
    <li>Guests and visitors of the university <ul>
    <li>one-off visitors;</li>
    <li>long term guests.</li>
</ul>

 </li>
    <li>The general public</li>
</ul>

So, some odd choices there re. line breaks (the nested UL list element on line 2 is placed on the same line as the parent LI element rather than starting a new line, for example) but nothing technically wrong. However, the nested UL elements are being followed by an empty line (RTE’s doing, not mine). For some reason this empty line (which should be ignored as meaningless whitespace) is being converted to an empty paragraph in the generated output HTML. Here’s what reaches the browser:

<ul>
    <li>Students: <ul>
    <li>undergraduate;</li>
    <li>postgraduate;</li>
    <li>students with on campus presence;</li>
    <li>distance learning students, and;</li>
    <li>international students.</li>
</ul>

 
</li><li>Staff: <ul>
    <li>academic staff;</li>
    <li>professional support staff;</li>
    <li>senior or VIP staff;</li>
    <li>staff in other service delivery functions of the university for example library or other student support services, and;</li>
    <li>second and third line IT staff.</li>
</ul>

 
</li><li>Guests and visitors of the university <ul>
    <li>one-off visitors;</li>
    <li>long term guests.</li>
</ul>

 
</li><li>The general public</li>
</ul>

Manually removing the empty lines from the RTE source view and saving the entry fixes the problem — but ONLY until the entry is resaved, at which point the unwanted whitespace and resulting paragraph elements promptly reappear.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases