|
Posted by Andy Dingley on 04/02/07 08:56
On 31 Mar, 12:29, patrick j <usemywebs...@googlemail.com> wrote:
> I'm wondering about lists with nested lists as one does on a Saturday
> afternoon.
Don't wonder, read the DTD and _know_.
You can't (validly) put anything inside a <ul> (or <ol>) except
<li>. So _anything_ you put in there, text, <p> or another nested
<ul> needs to go inside <li>. Not "adjacent to" or "after" <li>, but
contained wholly inside it.
It's SGML, so closing elements are generally optional. As the parser
"knows" that the only thing allowed inside <ul> is <li>, then it can
assume several things about the document, even if the literal </li>
tags have (correctly and optionally) been omitted.
<ul><li></li><ul>...
is clearly invalid. <ul> just can't be a child of <ul>.
<ul><li></li><li><ul>...</ul></li>
is valid. Containment is satisfied and the things that are children in
the document are permitted to be children by the DTD
<ul><li><li><ul>...</ul><li>...
is also valid. Some </li> are (permissibly) omitted. An SGML parser
can automatically generate a document tree from this that's equivalent
to having parsed the following document:
<ul>
<li></li>
<li>
<ul>...</ul>
</li>
<li>...</li>
</ul>
Navigation:
[Reply to this message]
|