Anchors with name _and_ id?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andrew

    Anchors with name _and_ id?

    Hi,

    I have routinely added anchors to pages using both name and id:

    <a name="example" id="example"></a>

    under the possibly mistaken assumption that at some stage "name" might
    be deprecated but "id" was unlikely to be.

    Can I ask what is accepted practice currently?

    Thanks for your trouble,

    Andrew

    --
    Andrew's Corner

  • Steven Simpson

    #2
    Re: Anchors with name _and_ id?

    André Gillibert wrote:
    Put the value in upper case letters.
    >
    <a name="EXAMPLE" id="EXAMPLE" href="URI">anch or text</a>
    >
    This is because the ID element type has a declared value of ID, while
    the NAME element type has a declared value CDATA.
    Values of attributes of declared value ID are case folded as specified
    by the HTML SGML declaration which contains "NAMECASE GENERAL NO", but
    CDATA values are never case folded.
    But what about this?:

    <http://www.w3.org/TR/html4/struct/global.html#ade f-id>

    id = name [CS]

    i.e. ids are case-sensitive. Is it an error, or am I misinterpreting it?
    For an extensive description of the issue, read:
    https://www.cs.tcd.ie/15445/UG.HTML#FOLDING
    --
    ss at comp dot lancs dot ac dot uk |

    Comment

    • David Stone

      #3
      Re: Anchors with name _and_ id?

      In article <slrnfehk9s.81j .usenet@debrand ed.larseighner. com>,
      Lars Eighner <usenet@larseig hner.comwrote:
      In our last episode, <slrnfehfi4.r6p .andrew@ilium.i nvalid>, the lovely and
      talented andrew broadcast on comp.infosystem s.www.authoring.html:
      >
      Hi,
      >
      I have routinely added anchors to pages using both name and id:
      >
      <a name="example" id="example"></a>
      >
      under the possibly mistaken assumption that at some stage "name" might
      be deprecated but "id" was unlikely to be.
      >
      That name would be deprecated was announced with XHTML 1.0 and name
      was deprecated for A and MAP in XHTML 1.1. Of course it is going to be in
      HTML 4.x forever and XHTML is pretty much neither fish nor fowl so let's not
      feed into that can of worms.
      But not html 5...



      "name attribute on map, img, object, form, iframe, a (use id instead)."

      Comment

      • Lars Eighner

        #4
        Re: Anchors with name _and_ id?

        In our last episode,
        <no.email-68874E.08413213 092007@news1.ch em.utoronto.ca> ,
        the lovely and talented David Stone
        broadcast on comp.infosystem s.www.authoring.html:
        In article <slrnfehk9s.81j .usenet@debrand ed.larseighner. com>,
        Lars Eighner <usenet@larseig hner.comwrote:
        >In our last episode, <slrnfehfi4.r6p .andrew@ilium.i nvalid>, the lovely and
        >talented andrew broadcast on comp.infosystem s.www.authoring.html:
        >>
        Hi,
        >>
        I have routinely added anchors to pages using both name and id:
        >>
        ><a name="example" id="example"></a>
        >>
        under the possibly mistaken assumption that at some stage "name" might
        be deprecated but "id" was unlikely to be.
        >>
        >That name would be deprecated was announced with XHTML 1.0 and name
        >was deprecated for A and MAP in XHTML 1.1. Of course it is going to be in
        >HTML 4.x forever and XHTML is pretty much neither fish nor fowl so let's not
        >feed into that can of worms.
        But not html 5...
        "name attribute on map, img, object, form, iframe, a (use id instead)."
        Where is the DTD?

        --
        Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
        Countdown: 495 days to go.
        What do you do when you're debranded?

        Comment

        • Benjamin Niemann

          #5
          Re: Anchors with name _and_ id?

          Hello,

          Harlan Messinger wrote:
          André Gillibert wrote:
          >andrew wrote:
          >>
          >>Hi,
          >>>
          >>I have routinely added anchors to pages using both name and id:
          >>>
          >><a name="example" id="example"></a>
          >>>
          >>under the possibly mistaken assumption that at some stage "name" might
          >>be deprecated but "id" was unlikely to be.
          >>>
          >>
          >Put the value in upper case letters.
          >>
          ><a name="EXAMPLE" id="EXAMPLE" href="URI">anch or text</a>
          >>
          >This is because the ID element type has a declared value of ID,
          >
          It does not. First, you mean "type", not "value",
          André is right: it is called "declared value". This may be confusing,
          because it is similar to the "type" in programming languages, but the SGML
          spec uses "declared value".
          and second, the type
          of the id attribute is "name".
          >
          http://www.w3.org/TR/html4/struct/global.html#h-7.5.2
          André refers to the HTML DTD. The HTML spec uses 'type' scheme on top of the
          SGML rules, but a real SGML parser does not know about that.
          >while
          >the NAME element type has a declared value CDATA.
          >>
          >Values of attributes of declared value ID are case folded as specified
          >by the HTML SGML declaration which contains "NAMECASE GENERAL NO", but
          >CDATA values are never case folded.
          >>
          >Semantically , id="example" is strictly equivalent to id="EXAMPLE" and an
          >HTML filter may apply such a case folding. However, name="example" isn't
          >equivalent to name="EXAMPLE".
          >

          >
          This is untrue. Both attributes are marked "[CS]" (case sensitive), and
          id="EXAMPLE" is not the same as id="example".
          It is case sensitive on the 'HTML level', which is one step above SGML. A
          SGML parser *does* fold id="example" into id="EXAMPLE" - HTML rules cannot
          change that. HTML will then treat this uppercased string case sensitive.


          --
          Benjamin Niemann
          Email: pink at odahoda dot de
          WWW: http://pink.odahoda.de/

          Comment

          Working...