[uf-dev] hCard test 30: empty ABBR element

Tantek Ç elik tantek at cs.stanford.edu
Wed Jun 21 07:27:56 PDT 2006


On 6/21/06 5:31 AM, "Drew McLellan" <lists at allinthehead.com> wrote:

> hCard test 30 relies on an empty, self-closing ABBR element for 'org'
> in the last hcard:
> http://microformats.org/tests/hcard/30-fn-org.html
> 
> As far as I can tell, an empty ABBR can't ever be valid. Its very
> purpose is to enclose an abbreviation that is then defined in the
> title attribute. With no abbreviation to define, you can't have an ABBR.

It certainly:

1. Is NOT semantically valid.  As you said, there is no abbreviated text,
thus it makes no sense for there to be an ABBR element.

2. Violates Appendix C. Compatibility Guidelines in XHTML 1.0, which we very
much prefer, and for all practical purposes MUST obey when publishing XHTML
on the Web.

3. Violates DRY since the title attribute of that ABBR simply duplicates the
previous IMG alt attribute value.


An empty ABBR should generate a warning at least.  Perhaps put that on the
list of things to check for a microformats validator.


And certainly to fix that test case, I would suggest changing it from:

<div class="vcard">
 <img class="fn" src="http://www.w3.org/Icons/w3c_home"
      alt="World Wide Web Consortium" />
 <abbr class="org" title="World Wide Web Consortium" />
</div>

to:

<div class="vcard">
 <img class="fn org" src="http://www.w3.org/Icons/w3c_home"
      alt="World Wide Web Consortium" />
</div>


And perhaps add another test case:

<div class="vcard">
 <object data="http://www.w3.org/Icons/w3c_home">
  <abbr class="fn org" title="World Wide Web Consortium">W3C</abbr>
 </object>
</div>



> To my surprise, the W3C validator doesn't care about empty ABBRs.

Because technically, in XHTML, *any* element can be empty since it is XML.

  
> Tidy, on the other hand, agrees with me and strips them out of the
> document. As my implementation is dependant on output from Tidy, I
> can't currently pass test 30.
> 
> So the burning question - which W3C tool is right? HTML Validator, or
> HTML Tidy?

They're both right for different reasons.

The validator is simply telling you that it *is* valid *X*HTML.

Tidy is telling you that an empty ABBR is irrelevant, both semantically, and
as far as having effect on the Web, and is thus removing it.


Ryan, could you fix the test case, perhaps as suggested above?


Thanks,

Tantek



More information about the microformats-dev mailing list