W3C home > Mailing lists > Public > www-validator@w3.org > September 2013

[VE][65] elements inducing context-sensitive constraints

From: Roland <silvermaplesoft@earthlink.net>
Date: Mon, 9 Sep 2013 19:15:07 -0400 (GMT-04:00)
Message-ID: <20690245.1378768507931.JavaMail.root@elwamui-huard.atl.sa.earthlink.net>
To: www-validator@w3.org
Error [65]: "document type does not allow element X here; missing one of Y start-tag"

This error message appears in situations like
    <body>
        <a name="top">
Using <a> in this manner is out of date, but it is the simplest example of the issue.

The missing 'Y' list is probably correct, but it is not explanatory. No place, on the W3C Web site nor outside literature, do I recall seeing a statement that the <body> element forces a context-sensitive requirement that all children be block-level elements. This is especially insidious when the error occurs somewhere deep within the code (I tested it as the last child) and it is easy to be oblivious to the fact that you're now back up to the child level.

The explanatory note includes the statement "This might mean that you need a containing element, ...." This is, of course, true, but it fails to note the special character of the <body> element. Anchor elements go so many places that it is hard to conceive that this is inappropriate. The blockquote element has the same undocumented constraint.

The paragraph element has the opposite constraint--it may not include a block-level element. This is a nuisance when I want to include a <pre> within a paragraph.

These context sensitive constraints (and any others) deserve special mention somewhere--within the error message would be most useful; after all, the parser knows the current token--without it the parser couldn't generate the list of possible predecessors.

R. W. Crowl
Received on Monday, 9 September 2013 23:15:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 9 September 2013 23:15:41 UTC