W3C home > Mailing lists > Public > www-style@w3.org > March 2005

[CSS21] Function parsing in declarations

From: Christian Roth <roth@visualclick.de>
Date: Tue, 22 Mar 2005 22:18:53 +0100
To: "www-style Mailing List" <www-style@w3.org>
Message-Id: <20050322211853.9399@mail.visualclick.de>

Suppose we have the following declaration:

  volume: -foo-marshall(11)

In 4.1.3, Characters and case [1], it reads:

"Only properties, values, units, pseudo-classes, pseudo-elements, and at-
rules may start with a hyphen (-); other  identifiers (e.g. element
names, classes, or IDs) may not."

I infer from this that functions (e.g. in values) are not allowed to
start with a hyphen by interpreting "may not" by english language rules
and not in the sense of "MAY" in RFC2119 [2]. But what are the
consequences from the above sentence for the parser? Two possibilities:


(a) Since functions "may not start with a hyphen", it can not reasonably
be part of the function name. Hence, the tokenization of the above
declaration must become:

 IDENT("volume")
 DELIM(":")
 S(" ")
 DELIM("-") /* since the hyphen cannot be part of FUNCTION */
 FUNCTION("foo-marshall(")
 NUMBER("11")
 )(")")

  or

(b) Since functions may not start with a hyphen, but -foo-marshall does,
it is simply invalid, and the declaration is discarded based on 4.2,
Rules for handling parsing errors [3].


Solution (a) would leave a backdoor to have unary minus on functions some
time later in CSS. Unfortunately, it requires a different Scanner
specifically for declarations, which is probably a very bad idea.

Solution (b) is in some way a "natural" solution, although it is nowhere
indicated in the specification why function names should be exempt from
the rule that vendor specific extensions should and can start with -foo-.
There might well be vendor-specific functions needed in some applications.

Could you please clarify the wording and intention of the spec in this regard?

[1] <http://www.w3.org/TR/CSS21/syndata.html#q6>
[2] <http://www.ietf.org/rfc/rfc2119.txt>
[3] <http://www.w3.org/TR/CSS21/syndata.html#parsing-errors>

Regards, Christian.
Received on Tuesday, 22 March 2005 21:26:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:36 GMT