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

On Wed, Jan 23, 2013 at 5:03 AM, Peter Moulder <peter.moulder@monash.edu>wrote:

> 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.
>

one reason to spec this behavior is CSSRule.cssText and
CSSStyleDeclaration.cssText:

   - should comments in style sheets or inline styles be reflected into
   cssText?
   - if writing cssText with values that contain comments, should those
   comments be present when reading?

absent specific spec language re: comments, one can't achieve interop in
these areas reliably

Received on Wednesday, 23 January 2013 14:20:19 UTC