Re: no-cascade proposition

[picking up on this thread again]

On Tue, Dec 9, 2008 at 4:19 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Niels Matthijs wrote:
>>
>> I think my wording is indeed a bit confusing. Rather than dig into the
>> specifics of cascading and inheritance, I'll say that I just want a full css
>> stop at one defined point. Nothing spills over, no matter how. In effect,
>> render the piece of included code as if there was nothing around it. This
>> includes ignoring statements like:
>>
>> * {font-size:131%;}
>>
>> As well as
>>
>> h2 {margin-left:60px;}
>>
>> Shifting the problem to html is an option, though it's really a styling
>> issue related to the workings of css and html-wise there should be little
>> interest in determining whether a piece of code is internal or external.
>
> Um...  Something somewhere needs to say exactly what elements shouldn't be
> styled.  That seems like a markup-level thing to me.

Some recent conversations about projects around my office made this
thread personally relevant.

We are defining just such a markup-level distinction in our work on
XBL-like things.  Selectors from the outer document won't match into
the inner, but we'd like inheritance to flow through it.  However,
we'd also like the ability to easily turn off inheritance when
desired, perhaps with some exceptions.

That is, if you're defining some widget, you may want to let the color
and background-color through, but not the font-size or text-shadow or
arbitrary other future inherited properties.

Given the situation I'm describing, I think we can do this pretty
easily within ordinary CSS.  The quick discussion I had with some of
the other people on my team led to the suggestion of an
"omni-shorthand" - a property that acts as a shorthand for *every
other property*.  It would only accept the values that are common to
all properties - 'initial' and 'inherit'.  You could then set the
above situation up like this:

widget {
  omni-prop: initial; /* Not a serious name proposal, obviously */
  color: inherit;
  background-color: inherit;
}

How does this sound?

~TJ

Received on Tuesday, 31 August 2010 00:46:26 UTC