On Apr 2, 2006, at 4:27 PM, Jim Grandy wrote:
It might be useful for implementing CSS inheritance, where an element inherits properties from its parent. CSS properties are inherited where the value of the property is "inherit"; this is the default value for many properties, such as the font properties. There's another mechanism in CSS, which is the application of properties to elements through the mechanisms of rules and selectors. For each CSS rule, you need to calculate which elements its declarations apply to. For each element, you need to order its declarations by their weight (whether there's an "!important" modifier), origin (which style sheet), specificity, and order of the rule within its stylesheet. It would be nice if you could represent each set of declarations (specified by a rule) as an object, and use the prototype chain order to represent the order. One problem is that, because "!important" modifies the declaration rather than the rule, different declarations in the same rule have different orders with respect to the declarations in other rules. It wouldn't be any great loss to omit "!important". Ordering by stylesheet origin may not be necessary in the context of LZX either, so long as inline styles override other styles. The (a?) remaining problem is that different sets of rules apply to different elements. For example, the declarations in R1 and R3 might apply to E1, while the declarations in R2 and R3 might apply to E2. To implement this with prototype inheritance, E1 would need to consult a prototype chain where R3's prototype was R1, and E2 would need to consult a chain where R3's prototype was R2. This could be implemented by cloning R3 before applying it to each element. This would still be two different prototype chains: one to represent the rules; and another to represent the containment hierarchy. The second chain is consulted when the first yields a value of 'inherit'. [*] By the way, the "cascade" itself in C[ascading]S[tyle]S[heets] refers to the ordering of rules by stylesheet origin, even though this isn't the most highly ranked facet in the ordering algorithm, or what with the benefit of hindsight is the most important feature of CSS.
|
_______________________________________________ Laszlo-dev mailing list Laszlo-dev@openlaszlo.org http://www.openlaszlo.org/mailman/listinfo/laszlo-dev