W3C home > Mailing lists > Public > www-style@w3.org > June 2012

Re: [css3-syntax] First draft of parser section completed

From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Date: Wed, 13 Jun 2012 23:28:12 +0800
Message-ID: <4FD8B18C.1050609@csail.mit.edu>
To: Simon Sapin <simon.sapin@kozea.fr>
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, WWW Style <www-style@w3.org>
(12/06/13 22:19), Simon Sapin wrote:
> Le 13/06/2012 14:35, Kang-Hao (Kenny) Lu a écrit :
>> (12/06/13 19:24), Simon Sapin wrote:
>>> Le 13/06/2012 12:29, Kang-Hao (Kenny) Lu a écrit :
>>>> 1. If a tinycss UA doesn't update it's tinycss and things like '$foo:
>>>> bar' becomes prevalent, would these input break the tinycss UA?
>>>>
>>>> Given that tinycss doesn't raise a exception to the UA, the answer here
>>>> is normally "No", but if this tinycss UA serializes CSS (say, a
>>>> minimizer) than the answer would be "Yes" (because '$foo: bar' is
>>>> dropped). I am curious about other tools that might answer "Yes" here.
>>>
>>> No, nothing would break in this scenario. Older UAs with an older parser
>>> will continue to see this input as invalid and drop declarations or
>>> rules.
>>
>> Why not? I think the comparison here is that serializing 'var-foo: bar'
>> won't be broken while serializing '$foo: bar' will be, and the amount of
>> '$foo: bar' out there were ignorable.
> 
> I don’t understand. Older UAs that do not support variables will
> continue to ignore variables declarations, and won’t break if they do
> not continue using compatible tinycss versions. By the way there is no
> serialization at all for declarations.

That's why I say normally "No" but "Yes" if the tinycss UA has to
serialize arbitrary declaration. Am I describing this correctly or not?

Note that I didn't say such a tinycss UA exist, so in reality this is
not likely to matter.

>>> Officially tinycss only has a serializer for selectors and property
>>> values. These are serialized exactly as parsed (the original strings are
>>> preserved), so the serialization should not change even if the token
>>> objects do.
>>
>> Which means that it handles 'var-foo' fine, right?
> 
> This is unrelated to serialization but yes, 'var-foo: bar' is a
> perfectly fine and normal declaration. It is up to the UA to treat
> specially properties whose name start with 'var-'.

What I am trying to do here is to understand what kind of compatibility
impact to tinycss would adopting '$foo: bar' vs. 'var-foo: bar' be. My
current understanding is that:

  For old UA, it almost never has a difference, but there is one
  rare case being that a hypothetical tinycss UA which has to
  serialize arbitrary declaration (e.g, a minimizer) would just wrongly
  drop '$foo: bar' while 'var-foo: bar' is correctly serialized. That
  kind of tinycss UA doesn't exist at the moment.

  For new UA, tinycss has to change it's code for '$foo: var' and when
  a UA upgrades its tinycss in use. There might be certain problem
  depending on how '$foo: var' is handled.

Perhaps you have a better statement? I am afraid but I am lost in the
statements like "By the way there is no serialization at all for
declarations." or "This is unrelated to serialization but yes...".

>> The reason I am saying this is that: The "3.6. Tree Construction" as it
>> is is closer to tinycss than, for example, Gecko because Gecko doesn't,
>> say, preserve unrecognized declarations. So, if tinycss has a way to
>> guarantee a good amount of future-compatibility, say, to include
>> css-heirarchy at least, it can be used as potential input to "3.6. Tree
>> Construction".
> 
> I don’t understand how this is related to tinycss or Gecko’s parser, but
> I agree that css3-syntax needs to make sure that css-hierarchy or
> *something like it* is possible. Even if hierarchies in their current
> form end up rejected, we may want to add more stuff in style rules later.
> 
> (By the way, tinycss currently does *not* preserve invalid declarations.)

That's why I said "unrecognized declarations", by with I mean something
like "foo: bar" which is preserved in tinycss and css3-syntax (at least
for now).

I just want to point out both CSS 2.1 Core Grammar and tinycss are a
forwards-compatible intermediate layer, which browsers, as far as I can
tell, don't have. If css3-syntax doesn't want such thing, as indicted in
Tab's message, that's good (and probably my preference too, given how
unreliable the CSS 2.1 Core Gramamr is), but if it does, it should
better be aligned with an implementation like tinycss.


Cheers,
Kenny
Received on Wednesday, 13 June 2012 15:28:47 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:55 GMT