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

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

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Wed, 11 Apr 2012 09:51:17 +0200
Message-ID: <9C389C5F0AC341C0A01F8C135AA6DD5E@FREMYD2>
To: "L. David Baron" <dbaron@dbaron.org>, "Andrew Fedoniouk" <news@terrainformatica.com>
Cc: <www-style@w3.org>
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 GMT

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