Re: name/id namespace

On Mon, 19 Aug 2002, Daniel Glazman wrote:

> Hi there,
> 
> Section 12.2 of HTML 4.01 spec explicitely says :
> 
>     name = cdata [p.50] [CS] [p.49]
>       This attribute names the current anchor so that it may be the
>       destination of another link.

Name is overloaded, and is primarily useful in form inputs, where
duplicates definitely are acceptable (e.g. in a bunch of checkboxes).

>	 The value of this attribute must be a
>       unique anchor name. The scope of this name is the current document.

I'd read that as meaning it must be unique in order to work properly
as a link target, not to meet the slightly different criterion of being
valid HTML.  The DTD - the machine-readable spec for HTML - explicitly
doesn't require uniqueness.

>       Note that this attribute shares the same name space as the id
>       attribute.

The id attribute must be unique, and is clearly defined as such in the
DTD (so any validator will complain if you have duplicate IDs in a
document, although there are some nasty gotchas re case-sensitivity).

> Please note the "must". But Validator.w3.org does not detect when two
> named anchors have same name in the same document.

If we accept your reading of that section, then we have an inconsistency
in the spec, which makes the HTML WG the guilty party.

>	 I did not test the
> case when a name attribute and an ID have the same value.

That is perfectly valid, provided there are no duplicate IDs.
Once again, it makes sense in the context of link targets, but not
in the context of other uses.

> IMHO, W3C's validator should test this unicity in the name/id namespace.

I agree such a warning would have some merit in a diagnostic tool,
but that tool isn't a validator.

-- 
Nick Kew

Looking for work: http://www.webthing.com/~nick/cv.html

Received on Monday, 19 August 2002 21:45:34 UTC