css-conditional suggestion

While progressive, the CSS3 Conditional Rules Module syntax for author
requirements can get verbose very quickly.

e.g.

@supports (display: inline-block) and (box-spacing: even) /* this list
can get horribly long */ {
    .boxes {
        display: inline-block;
        box-spacing: even;
    }
}


I propose a new, optional, condition keyword: 'all', to be used thus:

@supports all {
    .box {
        display: inline-block;
        box-spacing: even;
    }
}

Which is equivalent to the following:

@supports {
    .box {
        display: inline-block;
        box-spacing: even;
    }
}


The 'all' condition is equivalent to a condition with all contained
properties and values being chained together with 'and'. It is simple,
succinct, and will save CSS authors hours of typing!
The existing syntax remains available for times when, as with Example
VII, vendor prefixes or other more complex conditions using 'or' are
desired.
The 'all' keyword may evoke the CSS2 Media Type of the same name, but
unlike the 'all' media type, '@supports all' is not intended to mean
"supports all of CSS".



The following I am still unsure about:

Should CSS which the UA knows would not be applied in the current
situation, cause the entire ruleset to fail? For example, when
displaying the following *on screen*, should the box-spacing rule be
applied:

@supports all {
    .box {
        display: inline-block;
        box-spacing: even;
    }
    @media print {
        .box {
            paper-tray: 2;
        }
    }
}

Because, if an @-rule is encountered which is not understood (rather
than being understood but not applicable), then the @supports ruleset
must fail:

@supports all {
    .box {
        display: inline-block;
        box-spacing: even;
    }
    @dimensionality (hypercube: 4) {
        .box {
            projection: orthogonal;
        }
    }
}

Therefore, a UA that supports "@media print", but is rendering to
screen, knows it can ignore the "paper-tray" property, regardless of
whether it supports such a property. When the same UA is printing
however, and does NOT support paper-tray, then the entire ruleset
would not get applied.

n.b.  I considered @atomic, or even @supported, but felt the
simplicity of using the same rule name, and potential for confusion
with a variant like @supported, were too great to propose those.

-- 
Nicholas.

Received on Monday, 12 September 2011 16:01:23 UTC