Skip to content

[css-values-5] Invalidation of ident() #11424

Closed
@bramus

Description

@bramus

This is a follow-up to #9141 which introduces ident(). Something that is not defined yet is what should happen when the input for ident() is invalid.

E.g. what happens if you do the following:

@property --length {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.target {
  --length: 120px;
  anchor-name: ident("--anchor-" var(--length));
}

Because --length is a <length>, ident() can’t generate a valid <custom-ident>. I assume that in this case the declaration should become Invalid At Computed Value Time (IACVT) and the value should be considered to be unset.

However, we might also consider adding an extra argument to ident(), to allow a fallback value in case the constructed value is not a valid <custom-ident>.

The definition for ident() would then become the following:

<ident-fn> = ident(<ident-arg>+, <declaration-value>?);
<ident-arg> = <string> | <integer> | <ident>

I prefer this last version, as ident() then behaves similar to var() and attr(): when the input cannot be parsed into a <custom-ident> (or is the guaranteed invalid value) then the fallback value is used.

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