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

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.

~TJ

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