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

Re: [css-om][css3-conditional] spaces, newlines and rule serialization

From: Florian Rivoal <florianr@opera.com>
Date: Wed, 25 Jul 2012 19:36:29 +0200
To: www-style@w3.org
Message-ID: <op.wh0i63zs4p7avi@localhost.localdomain>
On Wed, 25 Jul 2012 17:57:11 +0200, Glenn Adams <glenn@skynav.com> wrote:

> my preference would be one line only, no indentation; and that whitespace
> must be in a minimized form, i.e., a single SPACE; if we leave whitespace
> less specific, then the serialization becomes ambiguous; i have notice  
> that
> in various tests that read the value of cssText, a literal comparison is
> made without further parsing, and such comparisons tend to be  
> non-portable
> given the current lack of specificity; for example, some browsers always
> append a "; " to the end of a serialized declaration block, effectively
> adding an empty declaration to the list; others do not; this type of
> difference needs to be eliminated if possible;

Opera used to not append ";" at the end, and we recently run into  
compatibility issues due to that, so we just aligned with the majority (or  
is it everybody?) and started appending ";". So we'd be in favor of  
speccing it that way, because that's what existing content seems to expect.

Glenn's proposal does sound like an simple compromise that would be easy  
to spec and implement, and would give us good interop, so I am tempted to  
agree, but it is also different from what everybody is doing today (I  
didn't test IE), so it worries me from a backward compatibility point of  
view.

On non-nested @media, Opera, Firefox and webkit (tested chromium) all  
break the line after the opening "{" of @media, and ident by 2 spaces, and  
put the closing brace non indented alone on its last line. None break the  
line after the brace opening a style rule or before the one closing it.

Currently, Opera also has the same multiline behavior as @media behavior  
on @keyframes, but nowhere else. Unless we agree on something else, our  
current plan is to keep that, add the same multiline behavior on @supports  
and @document, and to indent the nested things by multiples of 2 spaces.  
Like this:

@media all {
   @supports (foo: bar) {
     @keyframes baz {
       0% { height: 0px; }
       100% { height: 100px; }
     }
     div { width: 0px; color: blue; }
     @document url("http://www.example.com/") {
       #example1 { display: none; }
     }
   }
   @page { size:8.5in 11in; margin: 2cm; }
}

This is more complicated that what Glenn said, but it preserves the  
existing behavior, and extends it in a sensible way.

  - Florian
Received on Wednesday, 25 July 2012 17:35:48 GMT

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