in reply to Re: HTML tags in perl CGI scripts
in thread HTML tags in perl CGI scripts

It is true that, in general, the parsers won't care if your values are quoted or not. But, I'm going to have to recommend against this.

If you want to be forward thinking in the least, you should try hard to conform to W3C standards.
By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (") and single quotes ('). For double quotes authors can also use the character entity reference ". (source)


--
Rock is dead. Long live paper and scissors!

Replies are listed 'Best First'.
Re: Re: Re: HTML tags in perl CGI scripts
by iburrell (Chaplain) on Nov 14, 2002 at 17:52 UTC
    HTML (which is supposed to be an SGML application) doesn't require quotation marks around attribute values. The next paragraph of the specification says:

    In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them.

    It also recommends including the quotes. For one thing, XML requires quotation marks and always including quotes will make code easier to transition to XHTML.

    It is dangerous to leave out the quotes when interpolating a variable. Someone in the future might try to put a space (or a quote) in the variable. Browsers try to deal with broken markup but it is wise not to abuse the browser. Anyone leaving out the quotes because they haven't had a problem yet is going to be scratching their head in the future wondering why their HTML isn't working on some other browser or made an unrelated change in the code.

Re: Re: Re: HTML tags in perl CGI scripts
by mojobozo (Monk) on Nov 14, 2002 at 15:44 UTC
    Sorry, I never read it.
    _____________________________________________________
    mojobozo
    word (wûrd)
    interj. Slang. Used to express approval or an affirmative response to
    something. Sometimes used with up. Source