RE: [css3-values] RE: CSSStyleDeclaration#length and shorthands.



 6. Do the length and item() members of the CSSStyleDeclaration instance
   referenced by *ElementCSSInlineStyle.style represent only* the

   declarations present in cssText or not? If not, then what exactly do
   they represent? Longhand equivalents only? Longhand equivalents plus
   shorthand?

This is what we need to decide, yes.

> so which of these do you think is the right answer?


I think about this from the standpoint of available values, before I worry about length.

Example A
<div style=”border: red dashed 1px;”>
Example B
<div style=”border-color: red; border-style: solid; border-width: 2px;”>


JavaScript then queries…

1.       document.getElementsByTagName(‘div’)[0].style.border

2.       document.getElementsByTagName(‘div’)[0].style.border-color

I would argue that the answers should be…
A1           “red dashed 1px”
A2           “red”
B1           “red dashed 1px”
B2           “red”

My impression is that some would argue the answers should be…
A1           “red dashed 1px”
A2           “”
B1           “”
B2           “red”

I think rejecting A2 and B1 like that is both surprising to authors and presents either constraints on future shorthanding or incompatibilities when they are introduced.



As I mentioned previously, for cssText I understood the goal to be more minimalistic/concise and thus the coalescing makes sense.

Received on Wednesday, 1 February 2012 21:05:54 UTC