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

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

From: Brian Manthos <brianman@microsoft.com>
Date: Wed, 1 Feb 2012 18:47:45 +0000
To: Alexis Menard <alexis.menard@openbossa.org>, Boris Zbarsky <bzbarsky@mit.edu>, Glenn Adams <glenn@skynav.com>, Shane Stephens <shans@google.com>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <9710FCC2E88860489239BE0308AC5D170EB3053C@TK5EX14MBXC264.redmond.corp.microsoft.com>
@ 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 GMT

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