Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

[css-variables-1][css-values-5] Define "arbitrary substitution function" #10679

Open

Description

@tabatkins

In Variables, we have a lot of text defining how to handle a function that can be replaced by an arbitrary token sequence. In Values 5, we're adding several more functions that act similarly. I ended up just referencing the (undefined) concept of an "arbitrary substitution function", and had an issue saying I needed to define it in Variables at some point. Mixins also needs to reference this concept, for custom functions.

Well, I've defined it (in the commit that'll be referenced from this issue in a moment). Please review?

Notably, the only actually new text is the algorithms for "resolve a var() function" and "substitute an arbitrary substitution function"; the rest of the commit is just rearranging text and rephrasing some things to refer to the new generic term rather than be var()-specific.

Assuming this looks good, I'll need to follow up with some edits to Values 5 and to Mixins, to define resolution algorithms.

(Because of the text movement, reviewing the diff might be difficult; I recommend just checking the live Variables spec.)

Activity

  1. cdoublev commented on Aug 3, 2024

    @cdoublev
    Collaborator

    Arbitrary substitution functions can be used in place of any part of a value in any property on an element.

    UAs (at least Chrome and FF) already accept var() and env() in descriptors of page and margin rules, including size, ie. a descriptor whose name and grammar do not match those of a property.

    I suggest that:

    • <env()> should be valid for all declarations
    • <var()> should be valid for all declarations in element and cascade-dependent contexts
    • <attr()>, <random-item()>, should be valid in element-dependent contexts

    (edit) Reference for the next comment: #5969 (comment)

  2. andruud commented on Aug 7, 2024

    @andruud
    Member

    @tabatkins I read through it, LGTM.

    UAs (at least Chrome and FF) already accept var() and env() in descriptors of page and margin rules

    @cdoublev Huh. Looking briefly at the Blink code (StyleResolver::StyleForPage), I think var() would resolve against the root element. I don't think that's per spec.

    It's a separate issue, though.

  3. moved this to TPAC/FTF agenda items in CSSWG Agenda TPAC 2024on Sep 13, 2024
  4. moved this from TPAC/FTF agenda items to Regular agenda items in CSSWG Agenda TPAC 2024on Sep 13, 2024
  5. css-meeting-bot commented on Nov 7, 2024

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-variables-1][css-values-5] Define "arbitrary substitution function".

    The full IRC log of that discussion <florian> scribenick: florian
    <fantasai> https://drafts.csswg.org/css-values-5/#arbitrary-substitution
    <florian> fantasai: we do a bunch of substitutions, that check at computed value time it is valid
    <florian> TabAtkins: that's not appendix A in values 5
    <florian> s/not/now
    <TabAtkins> whoops
    <TabAtkins> i'll be right there
    <florian> fantasai: just asking if that's fine
    <fantasai> https://github.com//issues/10679#issuecomment-2266364116
    <florian> fantasai: other questions can be handle as a follow up question
    <florian> fantasai: guillaume asked about where these are valid
    <florian> fantasai: we might need to make that context dependent, based on which functions
    <florian> fantasai: that would be a follow up issue
    <florian> astearns: this is just spec definitions?
    <florian> fantasai: yes, for var. makes things more reusable
    <florian> fantasai: should not result in any changes in existing specs
    <fantasai> s/specs/features/
    <TabAtkins> astearns: glad Guillaume has already looked at this, he's a graet reviewer
    <TabAtkins> astearns: shall we leave it there and go on?
    <TabAtkins> scribe+
  6. kbabbitt commented on Nov 7, 2024

    @kbabbitt
    Collaborator

    Definition LGTM, the one suggestion I have would be to add a note clarifying the interaction with !important, similar to the second note under https://drafts.csswg.org/css-variables-1/#syntax

  7. tabatkins commented on Nov 7, 2024

    @tabatkins
    MemberAuthor

    Hm, that's specifically a note about custom properties, not about the var() itself. It wouldn't be relevant to any other substitution function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions