in reply to Re^2: PerlMonks has changed me
in thread PerlMonks has changed me

End LI tags are optional in HTML.

Replies are listed 'Best First'.
Re: PerlMonks has changed me
by jonadab (Parson) on Aug 31, 2005 at 12:20 UTC
    The closing li tags were optional in HTML, up through middle-to-late 1990s. This is no longer true for any even remotely recent version of HTML. The last several versions of HTML are XML document types, so all tags must be closed. Don't live in 1998: close your tags.
      The closing li tags were optional in HTML, up through middle-to-late 1990s. This is no longer true for any even remotely recent version of HTML. The last several versions of HTML are XML document types, so all tags must be closed.
      That is not correct. HTML and XHTML are not the same, and every version of HTML is an application of SGML. HTML thus allows for markup minimization when the corresponding document-type definition (DTD) says so, and all of the HTML DTDs – going back to the original version – define the LI element's end tag to be optional.

      As long as Perl Monks is served up in HTML, it will be perfectly acceptable to omit any tags the corresponding DTD says are optional.

      The W3C's HTML and XHTML Frequently Answered Questions addresses the underlying issues in detail.

      Cheers,
      Tom

        HTML and XHTML are not the same, and every version of HTML is an application of SGML

        No. XHTML is eXtensible HTML. That's what it stands for, and it was named that because that's what it is. SGML-based versions of HTML are very much legacy stuff at this point; they're not extensible in the way that XML is and should not be used going forward. update: and when the W3C says "HTML" today, they are almost always talking about XHTML. For instance, if you go to the W3C website and click on "HTML Activity Statement", everything there is about XHTML, not HTML4.

        If you find old information that says HTML4 is current and should still be used if XML embedding isn't needed, that dates from the very early XHTML era, before XHTML had fully stabilized, and it is no longer the case. Maintaining old, pre-existing HTML4 is one thing, but for new stuff you will do yourself a big favor in the long run if you write it as XHTML now.

        As long as Perl Monks is served up in HTML

        Ok, I had somehow missed the fact that Perlmonks is still serving out all of its pages as HTML4. Ugh. I imagine the reason for that probably has to do with the amount of work that would be involved with fixing it, given the complicated implementation of the site. Yes, if Perlmonks pages are served out as HTML4, then it's technically okay to omit closing tags as per the HTML4 spec, on Perlmonks.

        As a rule, however, it's a bad habbit of which you should really try to break yourself as soon as possible, for a wide variety of reasons. (I won't here go into all the reasons why XHMTL was and is needed, but the W3C has some information up about that. What they don't say is that XHTML is MUCH easier to maintain than legacy HTML, as well as easier to reliably parse.)


        "In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68
      That still doesn't make "<li />" tags acceptable. Quite the contrary: everything should be inside the "li" element, thus, between the "<li>" and the corresponding "</li>" tags.
        Quite the contrary: everything should be inside the "li" element

        Well yes, obviously. I was only pointing out that unclosed tags are no longer kosher in the modern era.

      What does this have to do with Perlmonks, which is HTML4?
        The file is declared as HTML 4.0 Transitional, but if you look at the tags the site uses it uses XHTML style tags with any unpaired tag ending in a /. So it appears to me that the site attempts to be XHTML, but declairs it self as HTML4 to prevent a poorly formated post from causing a strictly compliant browser from mis-rendering the whole page.