W3C home > Mailing lists > Public > www-html@w3.org > June 2003

ID and NAME tokens (CDATA problems)

From: Peter Foti (PeterF) <PeterF@SystolicNetworks.com>
Date: Wed, 4 Jun 2003 14:16:43 -0400
Message-ID: <A10A983C9DFBD4119F0300104B2EA6B72602D1@ZIPPY>
To: "'www-html@w3.org'" <www-html@w3.org>

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 ("."). 


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


Thus, if a form is defined as follows:

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

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


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

Peter Foti
Granite Stream
Phone: (603) 870-8170
Fax: (603) 870-8170
Received on Wednesday, 4 June 2003 14:03:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:04 UTC