- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Wed, 23 Jan 2013 10:36:33 -0800
- To: Philip Walton <philip@philipwalton.com>
- Cc: www-style list <www-style@w3.org>
On Wed, Jan 23, 2013 at 10:09 AM, Philip Walton <philip@philipwalton.com> wrote: > I'm writing about the new "all" property and I just wanted to make sure I'm > factually correct on a few points: > > "all" is just a regular CSS property and all the normal specificity rules of > the cascade apply, correct? > > That means that if I've done something like: > > #sidebar > div { background: red; } > > Then the following rule, if applied to a <div> in the sidebar will not > override the previous background definition. > > .widget { all: default; } > > If so, that implies that the all property cannot be used to achieve true > encapsulation, it's just a simple way for authors to undo what they've > already done (no judgment either way, just checking). > > Am I'm understanding this correctly? Yes. It's just a normal shorthand property, exactly the same as 'background' or 'transition' or 'border'. It just happens to shorthand *all* of the properties, rather than a subset. (For context, since Ms2ger just asked about this in another channel, the 'all' property was recently added to the Cascade module: <http://dev.w3.org/csswg/css3-cascade/#all-shorthand>.) Stronger encapsulation requires more powerful concepts than we can get with just the cascade, and probably coordination with other technologies. Luckily, precisely that already exists - the Web Components spec, which is being implemented in multiple browsers, is designed explicitly for this kind of thing, so you can write a widget and "hide" its DOM inside of a "shadow", which can't be targeted by the outer page's CSS at all unless the component author allows it. ~TJ
Received on Wednesday, 23 January 2013 18:37:22 UTC