This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1844 - Parser 'forgets' HEAD start tag when encounting self-teminating empty child element
Summary: Parser 'forgets' HEAD start tag when encounting self-teminating empty child e...
Alias: None
Product: Validator
Classification: Unclassified
Component: Parser (show other bugs)
Version: 0.7.0
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Terje Bless
QA Contact: qa-dev tracking
Depends on:
Reported: 2005-08-12 08:26 UTC by steffan
Modified: 2005-08-12 17:16 UTC (History)
0 users

See Also:


Description steffan 2005-08-12 08:26:11 UTC
When validating against a HTML DTD (either detected or through a manual overide)
the Parser 'forgets' about the HEAD start tag when it encounters a (invalid)
self-terminating empty tag (i.e. one using XHTML syntax).

As a minimum this results in reports that you have the following errors:

1. end tag for element "HEAD" which is not open
2. document type does not allow element "BODY" here

In addition - any elements in the HEAD that follow the trigger element are
reported in the form 'document type does not allow element "X" here', but any
that precede it, and the trigger element itself, are accepted (unless they
exhibit other errors).
Comment 1 Bj 2005-08-12 11:42:28 UTC
Yes, the end tag for <head> is optional in HTML, so parsers automatically close 
the element when they encounter content that is not allowed in <head>. And text 
is not allowed in <head>, in <link/> the / closes the <link> start tag and the 
> is processed as text content. Which is not allowed in <head>. The "self-
closing" tags in XHTML are not compatible with HTML. You don't get errors for 
e.g. <p><br/></p> because that's equivalent to <p><br>></p> which is allowed.
Comment 2 steffan 2005-08-12 17:16:42 UTC
Of course, I knew the XHTML syntax was not compatible but had not fully thought
through it's impact when element's parent was the head. Although not immediately
obvious the reference to problems caused by "implicitly closed element" does
indeed explain the nature of the problem.

Final thought - would some form of "Possible instance of XHTML syntax used in
error" type of "warning" (as opposed to error) be both possible and desirable?