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: Dave Raggett <dsr@w3.org>
Date: Fri, 21 Apr 2000 12:33:57 +0100 (GMT Daylight Time)
To: Randy Waki <rwaki@flipdog.com>
cc: html-tidy@w3.org
Message-ID: <Pine.WNT.4.10.10004211230290.-483837@hazel.hpl.hp.com>
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;
}

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
tel/fax: +44 122 578 3011 (or 2521) +44 778 532 0444 (mobile)
World Wide Web Consortium (on assignment from HP Labs)
Received on Friday, 21 April 2000 07:34:08 GMT

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