[thelist] Tip: Converting to XHTML, javascript, name, id

Jonathon Isaac Swiderski jswiders at cs.oberlin.edu
Mon Aug 26 12:30:01 CDT 2002


> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > From: Frank
> >
> > If you are converting your site or apps over to strict
> > XHTML 1.0, you'll find that using the "name" attribute
> > will raise the validator's danders. You're doing simple
> > error checking or roll-overs via Javascript. So now
> > you've got to use ID instead of name. What do you do?
> > What *do* you do?
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
> it depends on the element.  some elements are still allowed the use of the name attribute.

>From the XHTML 1.0 Recommendation, Section C.8: Fragment Identifiers
(http://www.w3.org/TR/xhtml1/#C_8):

	XHTML 1.0 has deprecated the name attribute of the a, applet, form,
	frame, iframe, img, and map elements, and it will be removed from
	XHTML in subsequent versions.

These are the *only* seven elements for which the name attribute is
deprecated.

Additionally, in the XHTML 1.0 Strict DTD, in the form elements section,
one finds the following:

	<!-- the name attribute is required for all but submit & reset -->

	<!ELEMENT input EMPTY>     <!-- form control -->
	<!ATTLIST input
	  %attrs;
	  %focus;
	  type        %InputType;    "text"
	  name        CDATA          #IMPLIED
	  value       CDATA          #IMPLIED
	...(other attrs snipped)...
	  >

Not only is the name attribute not deprecated for form elements, it's
*required*.


--
Jonathon Isaac Swiderski \\ dangercat-20 at dangercat.net
cs.oberlin.edu/~jswiders  \\  www.dangercat.net/?id=mt

The world is run by idiots because they're more efficient than hamsters.
	-- #bsddevel topic




More information about the thelist mailing list