Re: Why HTML should be taught as HTML without pretending it is XML

On 7/17/07, Ben Boyle <benjamins.boyle@gmail.com> wrote:
> I'm more interested in being able to teach people a particular syntax
> style of HTML like:
> <ul>
>   <li>item here</li>
>   <li>item here</li>
> </ul>
>
> As opposed to:
> <UL>
>   <LI>item here
>   <LI>item here
> </UL>

Consider the following also:

<!DOCTYPE html>
<html>
    <head>
        <title>title</title>
    </head>
    <body>
        <ul>
            <li>item here</li>
            <li>item here</li>
        </ul>
        <ul>
            <li>item here<li>item here</ul>
    </body>
</html>

Say if I want each LI's content to be exactly "item here".  By closing
the LIs, I can easily do this (parsing bugs aside).

If I just let the parser close the LIs, they might end up with comment
nodes and white-space etc. (or whatever else is lurking) in their
content unless I squish them together.

If the latter should be taught, it should be made clear to the student
where the content  of the element begins and ends. With the former,
it's easy as the content is inside something instead of being after
something and before something.

-- 
Michael

Received on Saturday, 21 July 2007 19:11:57 UTC