Skip to content

Dependency Cycles via Relative Units with unit algebra #1080

Open
@Loirooriol

Description

@Loirooriol

#315 was fixed without considering "unit algebra". CSS Values 4 allows dividing by dimensions, so we may have

@property --my-font-size {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
div {
  --my-font-size: calc(10em / 1px);
  font-size: calc(var(--my-font-size) * 1px);
}

That's a dependency cycle! It's not addressed by https://drafts.css-houdini.org/css-properties-values-api/#dependency-cycles, since that only handles registered properties with a syntax of <length> or <length-percentage>.

The example above uses <number>, but other dimensions like <angle> are also affected:

--my-font-size: calc(10em / 1px * 1deg);
font-size: calc(var(--my-font-size) / 1deg * 1px);

CC @tabatkins

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions