W3C home > Mailing lists > Public > www-style@w3.org > June 2014

Re: Cross Referencing Between Elements

From: Brian Blakely <anewpage.media@gmail.com>
Date: Wed, 11 Jun 2014 16:48:01 -0400
Message-ID: <CAJGQg4F-G7a3UgaDc6eFm+rc_QnKySg6dxOFx-ApN_HsqGuWzg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "www-style@w3.org" <www-style@w3.org>
Because the reference chain resolves back to the element being defined, the
selector is invalid.

Although the conditions for recursion should be refined to include the
property in our figurings.


In the below example, the element can safely reference itself.  Both .foo's
width and margin-right are 100px.

Safe Recursion Example
===

.foo {
  width: $(.foo margin-right 50px);
  margin-right: 100px;
}


In the next example, the first cross-reference selector resolves back to
the element being defined AND the property being defined.  Therefore, the
selector fails and the fallback argument is used.  Both .foo's width and
margin-right resolve to 50px.

Unsafe Recursion Example With Fallback
===

.foo {
  width: $(.foo margin-right 50px);
  margin-right: $(.foo width 100px);
}


In the following example, the first cross-reference does not possess a
fallback, and so the next cross-reference up the chain is asked for one,
which it provides.  Both .foo's width and margin-right resolve to 100px.

Unsafe Recursion Example Without Fallback
===

.foo {
  width: $(.foo margin-right);
  margin-right: $(.foo width 100px);
}

Finally, in the example below, neither cross-reference supplies a valid
fallback.  They are both considered "tainted" and both values are invalid.

Tainted Recursion Example
===

.foo {
  width: $(.foo margin-right);
  margin-right: $(.foo width);
}




On Wed, Jun 11, 2014 at 3:38 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 6/11/14, 3:36 PM, Brian Blakely wrote:
>
>> In an instance where the cross-reference ends up selecting the element
>> being defined
>>
>
> What if it selects some other element that itself cross-referenced the
> original element?
>
>
>  2) Arbitrarily deep cross-reference nesting.
>>
>
> This is not just a problem for the fallback.
>
> -Boris
>
Received on Wednesday, 11 June 2014 20:48:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:22 UTC