Re: Issue with the markup validator and img name

2012-08-22 20:21, tb-w3cvalidator@peperoni.de wrote:

> <img alt="" height="1" width="1" name="trackingUrl" src="http://...."/>
>
>
> - According to this comparison table, the "img" tag does not have the attribute "name" in any of the listed XHTML flavors:
>    http://www.w3.org/2007/09/dtd-comparison.html

The information on that page is inaccurate. The status of "name" varies 
by XHTML version. Among the "flavors" listed there, XHTML 1.0 Strict is 
the only one that does not allow "name" for "img".

> - Our local installation of the W3C markup validator (v0.8.5 with additionally installed XHTML Mobile Profile DTDs) does not accept the name attribute:
>               Attribute "name" exists, but can not be used for this element.

The XHTML Mobile Profile DTDs (which are not specifications or drafts by 
the W3C but by the Open Mobile Alliance) all include the XHTML Images 
Module,
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-image-1.mod
which specifies "name" as allowed for "img".

The error message sounds a bit like that validator is really an ad hoc 
checker rather than a (DTD-based) XML validator. In that case it would 
have an error here. The other alternative is that it uses wrong versions 
of the DTDs.

> - BUT http://validator.w3.org/ (v1.3) does NOT refuse the name attribute for any of these XHTML flavors:
>               XHTML 1.1
>               XHTML Basic 1.1
>               XHTML Mobile Profile 1.0
>               XHTML Mobile Profile 1.1
>               XHTML Mobile Profile 1.2

That behavior is correct, as these modularization-based DTDs all use the 
same XHTML Images Module.

>    The attribute "name" is only rejected for XHTML Strict 1.0:
>               there is no attribute "name"

Indeed. The XHTML 1.0 Strict DTD disallows it, whereas XHTML 1.0 
Transitional DTD allows it. This is one of the many silent changes 
(changes in DTDs only, not described or even mentioned in prose, in 
Changes section or elsewhere) made when constructing "XHTML 1.0 as a 
reformulation of HTML 4.01 in XML".

> Which one is right?
> - Is the W3C comparison table wrong AND our validator installation is broken?
>    (i.e. there is a "name" attribute for the "img" tag)
> - Or is http://validator.w3.org/ broken?
>    (i.e. there is no "name" attribute for the "img" tag)

The former.

Background:

The "name" attribute for "img" has a confusing history, so no wonder 
people who compose comparison tables or write checkers get confused. The 
attribute wasn't present in HTML 2.0 or in HTML 3.2, or even in HTML 4.0 
(1997, 1998). It was added in HTML 4.01 (1999) as one of the few changes 
from HTML 4.0, with the remark "for backwards compatibility". What this 
really meant was that the attribute was already in use, because it was 
useful in scripting (it was more robust to use document.images['foo'] 
than document.images[5]). The "id" attribute was available too (it was 
added in HTML 4.0) but was not in widespread use it.

The attribute is allowed in all versions (including Strict) of HTML 
4.01, but in XHTML 1.0, it was removed from the Strict version. However, 
in XHTML 1.1, it was re-established, because the modularization process 
had used definitions that allow the attribute, presumably because it was 
based on XHTML 1.0 Transitional, though with many removals:
"The modules defined in this document are based upon the element and 
attribute definitions in "HTML 4.01". However, all of the deprecated 
functionality and most of the "transitional" aspects of HTML 4 have been 
either removed from these modules or relegated to the "legacy" module."
http://www.w3.org/MarkUp/modularization
(The "name" attribute for "img" was mentioned as avoidable in HTML 4.01 
prose, but being present in all DTDs and lacking a "D" in the "Depr." 
column in http://www.w3.org/TR/html401/index/attributes.html it is 
understandable that it was not treated as deprecated.)
XHTML 1.2 was planned to use XHTML Images module, so if it had been 
completed, it too would have allowed "name" for "img".

Received on Thursday, 23 August 2012 07:37:59 UTC