W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [css3-regions] What's the benefit of @region compared to plain selectors?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 27 Feb 2013 14:35:53 -0800
Message-ID: <CAAWBYDC0opW3oGS8mXbAe7GUyr0RV-n-jf=n3m354etw_r5xLQ@mail.gmail.com>
To: Manuel Strehl <www-style@manuel-strehl.de>
Cc: www-style list <www-style@w3.org>
On Wed, Feb 27, 2013 at 7:47 AM, Manuel Strehl
<www-style@manuel-strehl.de> wrote:
> Hi,
> I've tried to wrap my head around the concept of the @region @-rule and
> failed to see the large advantage it gives over plain old selector chains.
> To give an example:
> @region #region-1 {
>   p {
>     color: pink;
>   }
> }
> and
> #region-1 p {
>   color: pink;
> }
> seem identical to me, in that they style the potion of stuff contained in
> the #region-1 element. I understand, that with the first declaration you can
> address explicitly elements coming via a flow-into source, while the latter
> addresses the original DOM elements before the flow is calculated.

Selectors operate on the DOM tree and elements, more or less.  Regions
do not operate at that level - they manipulate the *box tree*, where
boxes are things generated by elements, and are what actually renders.
 Thus, "#region-1 p" will never match anything, because the <p> isn't
a descendant of #region-1 - it's one or more of the boxes that <p>
*generates* that become descendants of the box that the #region-1
element generates.

You don't want to try and mix those levels and have selectors operate
on the box tree, because properties affect the box tree, so you
quickly get into crazy circular-dependency troubles.

Received on Wednesday, 27 February 2013 22:36:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:26 UTC