Closed Bug 277967 Opened 20 years ago Closed 20 years ago

Nested lists (ul/ol/li) aren't valid (rich text editor)

Categories

(Core :: DOM: Editor, defect)

1.7 Branch
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 54479

People

(Reporter: greut.lists, Assigned: mozeditor)

Details

(Whiteboard: midas)

The Midas implementation isn't making goog html/xhtml (well-formed but not valid).

DTD said :

<!ELEMENT ul (li)+>
<!ELEMENT ol (li)+>

Step to reproduce :

1) pick a rich text editor (http://www.kevinroth.com/rte/demo.htm)
2) build some nested lists like :

* A
   * B
* C

3) look at the source code (here the result)

<ul>
 <li>A</li>
 <ul>
  <li>B</li>
 </ul>
 <li>C</li>
</ul>
Looking at the spec the resould should be (in xhtml) :

<ul>
 <li>A
  <ul>
   <li>B</li>
  </ul>
 </li>
 <li>C</li>
</ul>

or (html valid) :

<ul>
 <li>A
 <ul>
  <li>B
 </ul>
 <li>C
</ul>

a solution (with regex or other) :

1) Deleting every </li>
2) Replace :
 * </ul>        ->  </li></ul>
 * </ul><li>    ->  </ul></li></ul>
 * (?!<ul>)<li> ->  </li><li> (a <li> not preceded by a <ul>)
(In reply to comment #1)
>  * </ul><li>    ->  </ul></li></ul>

</ul><li>   ->  </ul></li><li>

Sorry

Do either of you happen to know if this is a regression?

The output generated by Composer doesn't pass the validator @w3.org but I swear
it did long ago.  Any ideas or am I thinking of something else?

I haven't tested this on a recent trunk build (I see it in Mozilla 1.7.3 on Mac).
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Whiteboard: midas
This is not a regression. Duping to bug 54479

*** This bug has been marked as a duplicate of 54479 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
this PHP code correct the misteaks 
 
$html = preg_replace("#</li>#","",$html); 
while( preg_match("#</ul>[^>]*<ul>[^>]*<ul>#",$html) ) 
{ 
 $html = preg_replace("#</ul>[^>]*<ul>[^>]*<ul>#","<ul>",$html); 
} 
$html = preg_replace("#</ul>#","</li></ul>",$html); 
You need to log in before you can comment on or make changes to this bug.