You're right. There isn't any technical problem at all, but it is a design decision the HTML designers made, for simplicity or whatever other reason. In the HTML specs, <ul> elements are only allowed children <li> elements: http://www.w3.org/TR/html401/struct/lists.html#edef-UL
As mentioned, most browsers will try to parse the page regardless, and may even succeed, but it is always better to stay on the side of standards. On 9/6/07, Pops <[EMAIL PROTECTED]> wrote: > > > Sorry if I am a dounce, but I still don't see the invalidity of it. > > Do you have an example to show how this is incorrect in relationship > to anything (DOM? CSS?) ? > > The technical problem I see using this wrapping method is that you get > redundant (bubbling?) events. Is that right? > > Thanks > > -- > HLS > > > > On Sep 6, 1:57 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > > 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 > > -- Ted