mmcirvin: (Default)
[personal profile] mmcirvin
A pet peeve of mine: Often somebody on LiveJournal formats a list full of LI elements in the old-fashioned caveman HTML way, without closing tags, like so:

<UL> <LI> foo <LI> bar <LI> baz </UL>

Now, in the ultramodern XHTML world we have to close all our tags so we can't have that. So something in the system dreams up this abomination out of its little machine brain:

<UL> <LI> foo <LI> bar <LI> baz </UL> </LI></LI></LI>

Wrong, wrong, WRONG.

Date: 2003-09-06 09:54 am (UTC)
From: [identity profile] grumblepants.livejournal.com
Can you not do this:

<UL> <LI /> foo <LI /> bar <LI /> baz </UL>

It's still goofy of course. Whatever posessed them?

Date: 2003-09-06 01:30 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
It would have been far better to just leave the tags unclosed, rather than close them the wrong way. After all, any browser that expects to survive on the Web has got to be able to handle unclosed LIs.

Date: 2003-09-06 09:54 am (UTC)
From: [identity profile] grumblepants.livejournal.com
Ignore my previous comment, it's nonsense.

Date: 2003-09-06 02:32 pm (UTC)
From: [identity profile] kerri9494.livejournal.com
You call that whining? I'll give you whining. Why are they still using uppercase element names (and, presumably, attribute names)? XML is case-sensitive. XHTML requires attribute and element names to be lowercase. I think I need to go take a shower.

Date: 2003-09-06 02:43 pm (UTC)
jwgh: (Default)
From: [personal profile] jwgh
People writing <UL><LI><LI><LI></UL> are writing HTML, not XHTML, so I don't think this objection applies to what they're doing.

Date: 2003-09-06 02:49 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
Actually, in the situation I was really talking about, they were all in lowercase; I was just writing uppercase for emphasis.

Date: 2003-09-06 02:55 pm (UTC)
From: [identity profile] kerri9494.livejournal.com

But what are the people who are writing

<UL> <LI> foo <LI> bar <LI> baz </UL> </LI></LI></LI>

writing? MY DEATH KNELL?

Date: 2003-09-06 03:07 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
Well, I don't think it was a human being who wrote those closing tags. But it was a human being who wrote the code that did. My guess is that it was some sort of cleanup routine that just closes all hanging tags at the end of a block-level element. But, still, to close them OUTSIDE the block-level element is pretty brain-damaged.

Date: 2003-09-06 07:14 pm (UTC)
jecook: (Default)
From: [personal profile] jecook
You have to close your li tags before you close the list:

<UL> <LI> foo </LI> <LI>bar</LI> <LI>baz</LI> </UL>

I usually do in list format in the source anyway, so I can keep it straight:

<UL>
<LI>foo</LI>
<LI>bar</LI>
<LI>baz</LI>
</UL>

It also makes for easier changed to the content.

You don't have to close it in html. I can't remember if the validator will whine about it. I think it does, IIRC. Xhtml, I have no idea about. I have'nt gotten that far yet.

Date: 2003-09-06 02:45 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
Well, there are two different issues here: the syntax used by the LiveJournal database, and the syntax used by the style templates. I get the impression that the LJ database was constructed by people who sort of wanted LJ to be XHTML (though they don't try very hard to be 100% correct about it), but the built-in style templates are mostly done in the style of 1996-vintage Tag Soup, with no consciousness of this preference whatsoever.

If you have a paid account you can mess with the style templates to such an extent that you can fix the problems in them. (You'll notice there is no uppercase markup on my journal, and I think the lastn page is even validating as XHTML 1.0 Transitional today.) But the problems on the back end can't be fixed this way, not to mention problems in third-party content.

Date: 2003-09-06 02:47 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
The upshot of all this is, I guess, that if you really want your blog to be a good citizen of the modern Web, you should probably chuck LiveJournal and move to TypePad (http://www.typepad.com/) or something. But I like challenges.

Date: 2003-09-06 04:03 pm (UTC)
From: [identity profile] flummox.livejournal.com
That's funny. Ever since I wrote my first html back when I was a wee lad in 1994, I -always- used:

< UL> < LI> foo </LI> < LI> bar </LI> < LI> baz </LI> </UL>

No issues for me. Always did what I wanted it to do. The only tag that I didn't close was < P>.

Date: 2003-09-06 07:17 pm (UTC)
jecook: (Default)
From: [personal profile] jecook
::puts on badge labeled "HTML NAZI"::

Technically, you need to close those too. But I'm being anal now. Otherwise the validator will whine about it. Been there, done that.

Optional end tags

Date: 2003-09-07 05:26 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
It depends on which DOCTYPE you're using, actually. HTML has the concept of an optional end tag, but XHTML does not.

P and LI elements don't technically need explicit closing tags in HTML (even HTML 4.0 Strict!), though it's a good idea anyway, especially if you use lots of CSS layout.

But they do need to be closed in all versions of XHTML. All elements must have opening and closing tags in XHTML unless they are single-tag elements that are "self-closing", which is explicitly indicated with the closing slash, like so: <BR />

The difference is that HTML is theoretically an application of SGML, which had all sorts of weird methods for abbreviating tag syntax (most of which were never actually implemented in browsers!), whereas XHTML is theoretically an application of XML, which was intentionally designed to have much simpler and more restrictive syntax rules than SGML.

Re: Optional end tags

Date: 2003-09-07 05:28 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
Before Kerri objects... I meant <br /> since the standard XHTML elements are all written with lower-case tags.

Date: 2003-09-06 07:51 pm (UTC)
ext_8707: Taken in front of Carnegie Hall (quiet)
From: [identity profile] ronebofh.livejournal.com
Hmm, you're right, that's bogus. I will manually correct all my posts that contain lists now.

February 2026

S M T W T F S
1234567
8910 11121314
15 161718192021
22232425262728

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 26th, 2026 02:52 pm
Powered by Dreamwidth Studios