Re: Cross Referencing Between Elements

Yes, there are a couple issues with recursion.

Cross-reference selectors can be provided (and so, create recursion) in 2
cases:

1) As the selector argument.

2) In the fallback argument, as the selector of a nested cross-reference.

Recursion Issue 1
===

In an instance where the cross-reference ends up selecting the element
being defined, that should result in an invalid selector, leading to the
fallback value.  If no fallback was supplied, the result is an invalid
value.

Recursion Issue 2
===

A fallback can actually consist of another cross-reference.  This falls
prey to two recursion-related issues of its own:

1) The cross-reference in the fallback may select the element being defined.

If a cross-reference given as the value of another cross-reference's
fallback argument selects the element being defined, the entire value is
considered invalid.

2) Arbitrarily deep cross-reference nesting.

A cross-reference given as the value of another cross-reference's fallback
argument may not be supplied a cross-reference in its own fallback argument
(any other kind of value is still valid).  Without this restriction, it
becomes possible to nest arbitrarily deep, and I can't think of a good
use-case that warrants this behavior.

The maximum fallback chain looks like: Cross-Ref => Cross-Ref => Value.
 This provides a lot of utility while maintaining sanity.




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

> On 6/11/14, 2:34 PM, Brian Blakely wrote:
>
>> Error Handling
>>
>
> This section needs to at least define the behavior of:
>
> .foo {
>   width: calc( $(.foo width 90vw) - 200px );
> }
>
> as well as more complicated variants thereof.
>
> -Boris
>
>

Received on Wednesday, 11 June 2014 19:37:15 UTC