W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2000

RE: Bug and suggested fix: Tidy lets attribute names begin with '-','.', or a digit

From: Randy Waki <rwaki@flipdog.com>
Date: Fri, 21 Apr 2000 10:03:13 -0600
To: "Dave Raggett" <dsr@w3.org>
Cc: <html-tidy@w3.org>
Message-ID: <000001bfabab$19010dc0$28eee13f@whizbang.com>
On Fri, 21 Apr 2000, Dave Raggett wrote:
>
> On Fri, 14 Apr 2000, Randy Waki wrote:
>
> > 13-Jan-2000 Tidy doesn't complain about illegal attribute names
> > beginning with '-', '.', or a digit.  The problem is in
> > IsValidAttrName() in lexer.c where the first character isn't being
> > distinguished.
>
> Thanks for spotting this and for the patch. I will now use:
>
> /* attr must be non-null */
> Bool IsValidAttrName( char *attr)
> {
>     uint map, c;
>     int i;
>
>     /* first character should be a letter */
>     c = attr[0];
>     map = MAP(c);
>
>     if (!(map & letter))
>         return no;
>
>     /* remaining characters should be namechars */
>     for( i = 1; i < wstrlen(attr); i++)
>     {
>         c = attr[i];
>         map = MAP(c);
>
>         if (map & namechar)
>             continue;
>
>         return no;
>     }
>
>     return yes;
> }

Thanks, Dave.

For my own edification, I assume that checking for letters only is OK
because HTML does not define any attribute names beginning with '_' or ':'
(which are allowed by XML and I assume SGML).

Randy
Received on Friday, 21 April 2000 12:05:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:43 GMT