Re: CSSStyleDeclaration#length and shorthands.

On Tue, Jan 31, 2012 at 12:25 PM, Brian Manthos <brianman@microsoft.com>wrote:

> Glenn Adams:
> > My current thinking, on which I would like to hear from other commenters,
> > is that CSSStyleDeclaration.length should include all non-ignored
> shorthand
>
> Can you elaborate on what "non-ignored shorthand properties" means?


I really meant to say "non-ignored properties". Regarding ignored, at
present CSSOM [1] says:

Setting the cssText attribute must run these steps:

   1.

   If the CSS declaration block readonly
flag<file:///Users/glenn/work/w3c/csswg/cssom/Overview.html#css-declaration-block-readonly-flag>
is
   set, throw<http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-throw>
a
   "NoModificationAllowedError<http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#nomodificationallowederror>"
   exception and terminate these steps.
   2.

   Empty the CSS declaration block
declarations<file:///Users/glenn/work/w3c/csswg/cssom/Overview.html#css-declaration-block-declarations>
   .
   3.

   Parse<file:///Users/glenn/work/w3c/csswg/cssom/Overview.html#parse-a-css-declaration-block>
the
   given value and, if the return value is not null, insert it into the CSS
   declaration block
declarations<file:///Users/glenn/work/w3c/csswg/cssom/Overview.html#css-declaration-block-declarations>
   .


To parse a CSS value for a given property means to a parse the given value
according to the definition of the property that is an ASCII
case-insensitive<http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#ascii-case-insensitive>
match
for property in the CSS specification. If the given value is ignored return
null. Otherwise return the CSS value for the given property.

and CSS2.1 prescribes ignoring behavior (e.g., unknown properties, invalid
values, etc).



>  > properties that are declared in the associated CSS declaration block;
> i.e., if
> > CSSStyleDeclaration.cssText includes 5 non-ignored properties, of either
> > longhand or shorthand form, then length should be 5. This would apply to
> > both border:inherit (CSS2...) and border:initial (CSS3) if the appear in
> cssText.
>
> Example E
> <meta http-equiv="X-UA-Compatible" content="IE=9"/>
> <script>function OnLoad() {
> alert(document.getElementsByTagName("div")[0].style.background); }</script>
> <body onload="OnLoad();"><div style="background: none 0% 0% / auto repeat
> scroll padding-box border-box transparent"/></body>
>

Since all of the components specified for background correspond to their
initial values, I would expect the returned value to be "none" due to the
CSSOM:

Where CSS component values of the value can be omitted without changing the
meaning of the value (e.g. initial values in shorthand properties), omit
them. If this would remove all the values, then include the first allowed
value.


>
> Example F
> <meta http-equiv="X-UA-Compatible" content="IE=9"/>
> <script>function OnLoad() {
> alert(document.getElementsByTagName("div")[0].style.background); }</script>
> <body onload="OnLoad();"><div style="background: none"/></body>
>
> IE9's implementation reflects my understanding of CSS3 Background and
> CSSOM at the time.
>
> For both examples E and F, the alert displays "none".
>
> If you're suggesting that that should be changed, I find that troubling.
>

nope; IE9 reflects my current understanding as described above


> If you're suggesting something else, clarification would be lovely.
>

i'm just trying to express my understanding, but since this is a complex
and relatively underspecified area of behavior, i'd like to hear from
others, particularly if they have a different understanding

Received on Tuesday, 31 January 2012 19:50:11 UTC