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

@ Alexis, Boris, Glenn, Shane

Alexis:
> element.style.cssText = "border: 0;" and element.style.cssText =
> "border: inherit;" are not returning the same "element.style.length

In this portion of the original mail, both style.cssText and style.length are referenced.

My (lossy) recollection of my (imperfect) interpretation of the (pre-CR) specifications when working on backgrounds and borders for IE9...

a. style.cssText and style.length are related but not directly connected
b. style.cssText is designed as a serialize in/out mechanism, and should be concise (read: coalescing of redundancy should occur); expected usage is to get/set the entire style state
c. style.length refers to the collection of style.foo name-value pairs and should be complete and flexible (no coalescing); expected usage is to interrogate or set individual longhands or shorthands

The "what to include" algorithm for cssText is conceptually:
1. new collection 
2. collection += all set longhands from internal style state
3. collection += all composable shorthands, recursively to the highest order (border-left-style -> border-style -> border)
4. collection -= longhands (and shorthands) that are redundant relative to (higher order) shorthands

The "what to include" algorithm for OM style collection and thus style.length is conceptually:
1. new collection 
2. collection += all set longhands from internal style state
3. collection += all composable shorthands, recursively to the highest order (border-left-style -> border-style -> border)


Notice the difference in the (absent) fourth step for the latter.


Whether this aligns most with CSS2.1, CSS3 spec-at-the-time, or CSS3 spec-predicted, or some combination there-of I cannot recall.

How much of IE9 (beyond background and border) follows this heuristic, I never researched.

How much of IE9 background and border breaks these rules because of bugs or otherwise, I haven't kept track of.


Hope this helps. :)

Received on Wednesday, 1 February 2012 18:48:37 UTC