Re: ID and NAME (fwd)

Peter Flynn (pflynn@imbolc.ucc.ie)
26 Sep 1997 14:35:15 +0100


Date: 26 Sep 1997 14:35:15 +0100
From: Peter Flynn <pflynn@imbolc.ucc.ie>
In-reply-to: <199709252126.OAA17650@server.livingston.com> (message from
To: www-html@w3.org
Message-id: <199709261335.OAA11523@imbolc.ucc.ie>
Subject: Re: ID and NAME (fwd)


   >   <A NAME="fubar" ID="fubar">...
   >Perfectly OK, precisely because they _don't_ occupy the same
   >namespace.

   Note that Dave already replied that it is NOT ok.

I was answering from the SGML point of view. A document containing
<A NAME="fubar" ID="fubar">...</a> is perfectly valid if ID is
declared as ID and NAME is declared as CDATA.

   AND all of the specifications state quite clearly that they DO occupy
   the same namespace.

The specs are probably referring to the namespace inside browsers.

   If a browser does not put them in the same namespace, then the browser
   is in error.

No, for my money the spec is in error because ID and CDATA do not
occupy the same namespace in SGML. In HTML, HREF and NAME occupy 
a common namespace; ID and any IDREF attributes would occupy another.
Unless someone just changed the spec.

But the HTML spec and browsers' observance of it has now deteriorated
to such a low level that it really doesn't matter a damn. If you want
to treat them as the same namespace you are at liberty to do so. Just
don't expect a validator to resolve IDs to NAMEs because they won't:
HTML 4 says

<!ELEMENT A - - (%inline;)* -(A) -- anchor -->
<!ATTLIST A
  %attrs;                          -- %coreattrs, %i18n, %events --
  charset     CDATA      #IMPLIED  -- char encoding of linked resource --
  name        CDATA      #IMPLIED  -- named link end --
  href        %URL;      #IMPLIED  -- URL for linked resource --
  target      CDATA      #IMPLIED  -- where to render resource --
  rel         CDATA      #IMPLIED  -- forward link types --
  rev         CDATA      #IMPLIED  -- reverse link types --
  accesskey   CDATA      #IMPLIED  -- accessibility key character --
  shape       %Shape     rect      -- for use with OBJECT SHAPES --
  coords      %Coords    #IMPLIED  -- for use with OBJECT SHAPES --
  tabindex    NUMBER     #IMPLIED  -- position in tabbing order --
  onfocus     %Script;   #IMPLIED  -- the element got the focus --
  onblur      %Script;   #IMPLIED  -- the element lost the focus --
  >

where attrs includes coreattrs which says:

<!ENTITY % coreattrs
 "id          ID         #IMPLIED  -- document-wide unique id --
  class       CDATA      #IMPLIED  -- space separated list of classes --
  style       CDATA      #IMPLIED  -- associated style info --
  title       CDATA      #IMPLIED  -- advisory title/amplification --"
  >

///Peter