ID and NAME tokens (CDATA problems)

The HTML 4 recommendation states that:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods ("."). 

http://www.w3.org/TR/html4/types.html#type-cdata

However, I question whether the period should be allowed, as this is the
character used to access properties in JavaScript/ECMAScript:

http://www.ecma-international.org/publications/standards/ECMA-262.HTM

Thus, if a form is defined as follows:

<form action="" name="myform">
   <input name="readme.txt-title">
   <input name="readme.txt-author">
</form>

There does not seem to be any way to access those input items using their
names, because the dot notation:

document.myform.readme.txt-title

causes the script interpreter to look for input named "readme", because the
period is seen as the indicator of the next property.  In this case, the
only way to access the item is through the array notation, which can be
expensive if the index of the input item is not known (could require
iterating through all of the input items in the array).

I have not found any other mention of this limitation in either the ECMA-262
specification or the HTML recommendations, but it seems to me like it's
either an oversight in the HTML recommendations, or else there must be some
other hard-to-find documentation that discusses a workaround for this
shortcoming.

Peter Foti
Granite Stream
Phone: (603) 870-8170
Fax: (603) 870-8170

Received on Wednesday, 4 June 2003 14:03:37 UTC