On 15/02/2011 3:34 AM, L. David Baron wrote:
On Monday 2011-02-14 15:27 +0000, Barney Carroll wrote:
In any case, re-specifying sub-properties via a
short-hand over and over again through inheritance is actually detrimental
to CSS performance — having more properties enforced unnecessarily is bad on
that front.

In Gecko, the opposite is true:  specifying a shorthand improves
performance, although the effect is small enough it may be hard to
measure in most cases.

We compute style data in groups of properties, and the groups
intentionally match some of the major shorthands (in particular,
background, padding, border, outline, and margin; not font anymore,
though we should fix that).  When computing each group of style
data, we look through rules from most-specific to least-specific
until we have a specified value for all the properties in the group.
Having a shorthand short-circuits this check by ensuring that there
is a value for all the properties.

-David


Hello David.

This is interesting and you mention all properties and most-specific. Taking padding, background and border for example, would the following CSS allow the computation to happen quicker.

[dir*="t"] * {
  padding-top: 0;
  padding-bottom: 0;
  background: none;
  border: none;
}

[dir="ltr"] ol,
[dir="ltr"] ul {
  padding-left: 40px;
  padding-right: 0;
}

[dir="rtl"] ol,
[dir="rtl"] ul {
  padding-left: 0;
  padding-right: 40px;
}

It would require adding a 'dir' attribute to the HTML.

<html dir="...">


Or possibly using the 'lang' attribute with [lang="en"].



--
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to