W3C home > Mailing lists > Public > www-validator@w3.org > August 2012

Re: Issue with the markup validator and img name

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Thu, 23 Aug 2012 09:24:18 +0300
Message-ID: <5035CC92.9040102@cs.tut.fi>
To: "www-validator@w3.org" <www-validator@w3.org>
CC: tb-w3cvalidator@peperoni.de
2012-08-23 8:30, Michael[tm] Smith wrote:

> tb-w3cvalidator@peperoni.de, 2012-08-22 19:21 +0200:
>
>> Hello,
>>
>> I have an issue with the markup validator regarding the "img" tag in
>> various mobile flavors of XHTML. We are integrating mobile ads into our
>> XHTML pages, but this one does not pass our validator installation
>> because of the "name" attribute:
>>
>> <img alt="" height="1" width="1" name="trackingUrl" src="http://...."/>
>> [...]
>> 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)
>
> I don't know the answer to those specific questions, but I think the
> general answer is that there's no good reason to be using the name
> attribute on the img element.

Well, yes, more or less. To quote the HTML 4.01 specification:

"name = cdata [CI]
     This attribute names the element so that it may be referred to from 
style sheets or scripts. Note. This attribute has been included for 
backwards compatibility. Applications should use the id attribute to 
identify elements."

> Browsers don't do anything with it, nor do
> any other applications that I'm aware of.

The name attribute has widely been used in scripting. Although it is 
possible (and recommendable) to move to using the id attribute, the 
point is that you should not just remove the name attribute. It has 
probably been used for a reason - and you would need to remove that 
reason too. Changing script code can be a major effort, and even risky. 
It is usually not productive to change code that works.

Yucca
Received on Thursday, 23 August 2012 06:24:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 23 August 2012 06:24:56 GMT