Fun with ignorable whitespace definition.

Consider how the following html will be parsed.

<title>Title text</title>

<meta foo=bar>
Now we have the body.

In here, we have some whitespace after </title>. It is not quite
ignorable, so it should be treated as text. Therefore, it should close the
head element and start body element. As a result, 'meta' would go into the
body and not the head and will be ignored.

That presents IMHO a problem, since the meaning was clearly to ignore all
whitespace in the head, but having optional end of head and optional start
for body messes it up.

On another hand, parser cannot just ignore that whitespace as it does not
know (in a generic html parsing world) if content of html (or head) can be
displayed and CSS might declare it to have non-collapsable whitespace
(like in PRE).

It looks to me, that either this requires a heavy special case or html4
draft is missing a section on how a whitespace treated in non-displayable
optional start/end elements... :=}

I hope I am missing something, because it sure got me thinking. :-}


Received on Sunday, 7 December 1997 03:41:10 UTC