Re: [css-syntax, ideas-needed] Merge/inherit lists of values.

There's a proposal I did some time ago called "List valued properties".

In short and with a sample:

    #el {
        transform: translate(-10,-10);
    }

    .zoomed {
        transform[zoom]: scale(1.1); /* defines transform's "zoom" priority 
for #el.zoomed */
    }

    .rotated {
        transform[rotation]: rotate(180deg); /* defines tranform's 
"rotation" priority for #el.zoomed */
    }

    .zoomed:hover {
        transform[zoom] scale(1.2);
    }

equals:

    #el1.zoomed.rotated {
        transform: concat-list(
            item(none,translate(-10,10)),
            item('zoom',scale(1.1)),
            item('rotation',rotate(180deg))
        );
    }

    #el1.zoomed.rotated:hover {
        transform: concat-list(
            item(none,translate(-10,10)),
            item('zoom',scale(1.2)),
            item('rotation',rotate(180deg))
        );
    }

Order proposal in a list is the following:

    1) Items having no ItemID are always last values.
    2) ItemID priority is the same as the specificity of the lowest 
specificity declaration where the ItemID is declared.

I also proposed:

    .specialEffect {
        box-shadow[]: a b c d; /* unique ItemID, don't allow override */
    }

BTW, in the case my proposal is accepted, we could even solve Issue 1 of the 
css3-variables proposal:

    :root { var[NAME]: value; }
    xyz { property: var[NAME]; }

In such case, "element.computedStyle.var" would return all currently valid 
variables on the element.

Best regards,
François






-----Message d'origine----- 
From: L. David Baron
Sent: Tuesday, April 10, 2012 11:55 PM
To: Andrew Fedoniouk
Cc: www-style@w3.org
Subject: Re: [css-syntax, ideas-needed] Merge/inherit lists of values.

On Tuesday 2012-04-10 14:44 -0700, Andrew Fedoniouk wrote:
> used value of background-image-transformation will be this:
>
>    background-image-transformation: gamma(1.4) flip-x();
>
> I suspect that for implementation of such inheritance some change on
> CSS grammar/syntax level is required.
>
> I am thinking about something like !inherit modifier:
>
> div:dir(rtl) {
>    background-image-transformation: flip-x() !inherit;
> }

But this isn't about inheritance at all: this is about handling of
multiple rules applying to the same element (cascading) rather than
propagation of computed values from ancestor to descendant
(inheritance).

We've previously discussed this sort of thing a few times under the
name "additive cascade", though never really come to any conclusion.

> I suspect that such inheritance feature could be useful for any other
> properties that accept lists of values. For example 'background'
> property that accepts lists of image definitions. In some cases
> it could be useful to combine two or more such list rather than
> to just override by heaviest rule.

Also counter-* and a few other things.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂 

Received on Wednesday, 11 April 2012 07:51:48 UTC