W3C home > Mailing lists > Public > www-style@w3.org > January 2013

Re: [css3-syntax] Consumation of comment tokens during tree construction

From: Peter Moulder <peter.moulder@monash.edu>
Date: Wed, 23 Jan 2013 23:03:24 +1100
To: www-style@w3.org
Message-id: <20130123120323.GA3202@bowman.infotech.monash.edu.au>
On Wed, Jan 23, 2013 at 09:45:40AM +0100, Simon Sapin wrote:

> As much as I dislike having to do this, shouldn’t some comment
> tokens be preserved where the tree has "lists of primitives" so it
> can be serialized back correctly? Namely:
> 
> * at-rule prelude
> * selector
> * declaration value
> 
> Example of pathological input:
> border: 1px/**/solid

One possible answer is that it's the job of the serializer to insert a
comment token if asked to serialize the sequence DIMENSION IDENT, whether
or not we strip out comment tokens.

(This issue is already foreseen in comments in libcroco tokenizer source,
and may well similarly be already foreseen by code elsewhere that does
serialization.)

Another possible answer might be that this spec doesn't have to care
about serialization; is there or might there in future be a CSS spec that
covers serialization of a CSS core grammar token stream defined in terms
of css3-syntax, perhaps something related to CSSOM?  If the spec only
needs to give the right parse rather than the right re-serialization,
then this spec can omit the comment tokens.

For each of the above possible answers, there are counter-arguments
related to reducing bugs in practice.  I'm not expressing a preference
either way, I'm just making sure the decision gets made knowing that
there's a choice.

pjrm.
Received on Wednesday, 23 January 2013 12:03:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:04 GMT