W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 1999

Re: Tidy doesnt require 'type' on 'style'

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 7 Jul 1999 23:07:01 +0200
Message-ID: <00a701bec8bf$bc8d7b10$c7e0a8c0@de>
To: "Bjoern Hoehrmann" <derhoermi@gmx.net>
Cc: <html-tidy@w3.org>
| I suggest to insert a type="text/css" automatically.

To accomplish that, i copied most of the CheckSCRIPT code. I did the
following:

Added to attrs.c:

void CheckSTYLE(Lexer *lexer, Node *node)
{
    Attribute *attribute;
    AttVal *attval, *type;

    type = null;

    for (attval = node->attributes; attval != null; attval = attval->next)
    {
        attribute = CheckAttribute(lexer, node, attval);

        if (attribute == attr_type)
            type = attval;
    }

    if (!type)
    {
        ReportAttrError(lexer, node, "type", MISSING_ATTRIBUTE);

        /* If no type is specified for STYLE, set the type to text/css */

        type = (AttVal *)MemAlloc(sizeof(AttVal));
        type->attribute = wstrdup("type");
        type->value = wstrdup("text/css");
        type->next = node->attributes;
        type->delim = '"';
        type->dict = FindAttribute(type);
        node->attributes = type;
    }
}

Inserted in line 663 of html.h:

CheckAttribs CheckSTYLE;

and changed line 89 of tags.c to:

    "style",      (VERS_FROM32|VERS_FRAMES),  CM_HEAD, ParseScript,
CheckSTYLE,



I'm not that familiar to C, so there may be better ways to implement the
insertion of text/css, but this works fine at least in my privat version.

regards,
 Bjoern Hoehrmann
Received on Wednesday, 7 July 1999 17:30:06 GMT

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