He's referring to how lists (UL and OL) are built up in the DOM (from
the HTML). Lists can only have LI elements as children.

So these are valid:

<ul>
  <li>blah</li>
</ul>

<ul>
  <li>blah
    <ul>
      <li>blah</li>
    </ul>
  </li>
</ul>

But these are invalid:

<ul>
  <ul>
    <li>blah</li>
  </ul>
</ul>

<ul>
  <li>blah</li>
  <ul>
    <li>blah</li>
  </ul>
</ul>

Browsers probably attempt to twist the invalid code into a valid
format, but you can't be sure it's going be what you expect.

Karl Rudd

On 9/6/07, Pops <[EMAIL PROTECTED]> wrote:
>
> Klaus,
>
> Today, this has thrown me for a loop:
>
> > Is that reallly the HTML? If so, it is invalid and you cannot expect any
> > selector to be reliable in any browsers. I'm not refering to the missing
> > slashes in the closing tag - I assume you just left them out in the
> > example here -, but the incorrectly nested inner ul.
>
> I think I matched it as you think, wrapping  LI around a UI
>
> <ul>
>   <li> item1 </li>
>   <li> Item2
>     <ul>
>         <li> item1 </li>
>         <li> item1 </li>
>     </ul>
>   </li>
> </ul>
>
> But why is the followng is this invalid?
>
> <ul>
>   <li> item1 </li>
>   <li> Item2 </li>
>     <ul>
>         <li> item1 </li>
>         <li> item1 </li>
>     </ul>
> </ul>
>
> The reason I ask is becaus thiis idiom you provided:
>
>     The first li of a ul is:
>    $('ul>li:first-child')
>
> Works for both.  I don't think neither are invalid.
>
> Are you referring to how menus plugins rely on a wrap?
>
> What I am missing?
>
> --
> HLS
>
>

Reply via email to