#513: CSS advanced attr() function

Visit on Github.

Opened May 13, 2020

Hello TAG!

I'm requesting a TAG review of the advanced version of the CSS attr() function.

The attr() CSS function is used to retrieve the value of an attribute of the selected element and use it in the stylesheet. There are two versions:

  1. Basic version: Specified in CSS2. Allows usage in pseudo-element content property only as a string. This is already supported by all major browsers.
  2. Advanced version: Specified in CSS Values and Units L4. Allows usage in all CSS properties, and can represent various types of values

You should also know that...

In CSS4, the feature has been substantially revised to ease implementations. Most importantly, it now works similar to var(), namely, attr() is considered valid at parse time, and the actual validation of the attribute value is deferred to computed value time. Please review this version.

We'd prefer the TAG provide feedback as (please delete all but the desired option):

💬 leave review feedback as a comment in this issue and @-notify

Discussions

Comment by @cynthia May 26, 2020 (See Github)

@kenchris and I briefly discussed this during the VF2F, and concluded this is probably best reviewed by someone else. @torgo @plinss help?

Comment by @hober May 27, 2020 (See Github)

N.B. these open css-values-4 issues:

Comment by @hober May 27, 2020 (See Github)

Hi @xiaochengh!

@dbaron, @plinss, and I looked at this during the TAG F2F this week. We note that there is active discussion on the open issues I linked above, and we're happy to see that the CSS WG is trying to figure all of this out right now. Note that in the CSS WG, editors often add proposals to specs, which then get reviewed and resolved on by the WG. The TAG generally does our design review later in that process, after the WG resolutions. When these issues have been resolved, please come back to us and we'd be happy to review the result.

Comment by @xiaochengh May 27, 2020 (See Github)

Thanks! I'll wait until the CSSWG fixes the spec.

Comment by @tursunova Nov 14, 2024 (See Github)

Hi @hober!

Could we please reopen this issue for TAG review or should I create a new one? We are planning to ship attr() in Chromium and currently there are no open CSSWG issues left for attr.

Thank you.

Discussed Dec 16, 2024 (See Github)

Tess: Not all the CSS PRs are closed.

Martin: Your general disposition is positive, there are just details?

Tess: Yes.

Martin: I want to use this. It's nontrivial to implement but useful.

Peter: -> pending feedback

Tess: happy to close our review once they've closed their issues.

Comment by @hober Dec 17, 2024 (See Github)

Could we please reopen this issue for TAG review or should I create a new one? We are planning to ship attr() in Chromium and currently there are no open CSSWG issues left for attr.

It looks like w3c/csswg-drafts#5079 is still open.

Discussed Jan 6, 2025 (See Github)

Jeffrey: In their I2S (https://groups.google.com/a/chromium.org/g/blink-dev/c/2dNLhQN9SNs/m/VP2BPdE5AQAJ), they say #5079 is resolved by a change in CSS Values and Units Module Level 5.

Peter: The overall feature is good. Devil is in the details, and we should trust the CSSWG to get that right.

Jeffrey: So we should close this as satisfied?

Peter: Let's ping Tess, and then yes.

[Tess was pinged and said ok; Jeffrey closed the issue.]

Comment by @jyasskin Jan 7, 2025 (See Github)

We see that your I2S says https://github.com/w3c/csswg-drafts/issues/5079 is resolved by some wording in https://drafts.csswg.org/css-values-5/#attr-security. Given that the overall feature is a good idea, and the CSSWG is the right group of experts to figure out the details, we're satisfied with this feature. Thanks for bringing it to us!