Re: 1 element becomes 2

Hannes Kirsman wrote:

> is this a bug of firefox or w3c validator?

No, it's an error in your document. Technically, it might not be an error 
(impossible to say without a URL), but in that case it's a matter of your 
misunderstanding.

> I have <a href="" /> tag

Why?

You should not use XHTML in the first place, unless you really know what you 
are doing, and 99% of XHTMLers don't.

Even if you use XHTML, you should not use self-closing tags for anything but 
elements with EMPTY declared content, as both XML and XHTML specs say. If 
you didn't understand this, you _surely_ should not use XHTML!

> and firefox shows 2 a tags.

It internally parses the tag as equivalent to <a href=""></a>, which is the 
correct parse (and, as an element, makes no sense under any normal 
conditions - a link with empty link text).

> W3C validator says all is ok.

That's because it's still basically a validator and only reports violations 
of formalized syntax rules. It says "ok" for a large variety of documents 
that violate HTML specifications, or are poorly written, or just don't make 
sense. That's because its "ok" is just a statement about lack of reportable 
markup errors.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Wednesday, 20 May 2009 17:56:45 UTC