W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > July to September 2002

RE: Invisible "Skip navigation" link

From: Jukka Korpela <jukka.korpela@tieke.fi>
Date: Wed, 24 Jul 2002 10:19:27 +0300
Message-ID: <621574AE86FAD3118D1D0000E22138A95BDD6E@TIEKE1>
To: "'WAI IG'" <w3c-wai-ig@w3.org>

Steve Vosloo wrote:

> To cover all bases it seems a good idea to always put a space after a
> text description, and usually after some sort of punctuation:
> <a href="#content" title="Skip Navigation. Access key = 2. ">
> <img src="hello.gif" alt="Hello world. ">
> <frame src="banner.html" title="Frame banner. ">

In practice, I tend to agree, at least in situations where alt texts would
otherwise "run together".

But we have a problem here. The HTML 4 specification says that user agents
may ignore leading and trailing spaces in attributes (e.g., treat alt="foo "
as equivalent to alt="foo") for "CDATA attributes" (such as title, alt, and
many others). This is specified in section 6.2 "SGML basic types" (so you
may easily miss it when using the specification as a reference):
And it even says in this context: "Authors should not declare attribute
values with leading or trailing white space." (Someone might interpret this
"only" as a strong way of saying that authors should not _rely_ on such
space being preserved.)

XHTML is a different beast:
"Whitespace in attribute values is processed according to [XML]."
And this means strict (and fairly complicated) normalization rules:
But those rules do not make stripping leading and trailing spaces mandatory
for CDATA attributes - though they _do_ require such stripping for other
attributes! (And they require compression of multiple spaces, so that
alt="foo  " is normalized to alt="foo ".)

It's difficult to say whether XHTML is intended to _allow_ stripping of
leading and trailing spaces in CDATA attributes (as HTML 4 does).

Note that if such stripping is allowed, alt=" " can be treated as identical
to alt="", which would not be nice at all if e.g. the image is a separator
between adjacent words.

Jukka Korpela, senior adviser
TIEKE Finnish Information Society Development Centre
Phone: +358 9 4763 0397 Fax: +358 9 4763 0399 
Received on Wednesday, 24 July 2002 03:16:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:36:10 UTC