Skip to content

Conversation

@codersjj
Copy link
Contributor

Description

This updates the explanation of how attr() behaves when used in URL-related contexts.
The previous text implied a general restriction, but the real limitation applies only when the value is required to be a <url> type.

The revised wording explains that:

  • attr() values are attr-tainted.
  • Using them in a context requiring a <url> (e.g. inside url() or background-image) results in IACVT.
  • Some functions—such as image-set()—accept a <string> first, which is later interpreted as a URL. This can allow attr() to work in shorthand properties like background, although it does not work in background-image.

Motivation

This update was made after watching a video by zhangxinxu on bilibili:
https://www.bilibili.com/video/BV1dPkzB3Esx
I realized the documentation should more accurately reflect the difference between <url>-required contexts and cases where <string> is allowed before URL resolution.

@codersjj codersjj requested a review from a team as a code owner November 14, 2025 09:43
@codersjj codersjj requested review from estelle and removed request for a team November 14, 2025 09:43
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed labels Nov 14, 2025
@github-actions
Copy link
Contributor

Preview URLs

Flaws (52)

URL: /en-US/docs/Web/CSS/Reference/Values/attr
Title: attr()
Flaw count: 52

  • broken_links:
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#question_mark is a redirect
    • Can't resolve /en-US/docs/Web/CSS/declaration-value
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#question_mark is a redirect
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#brackets is a redirect
    • Can't resolve /en-US/docs/Web/CSS/ident-token
    • and 32 more flaws omitted
  • macros:
    • Macro produces link /en-US/docs/Web/CSS/content which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/var which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/type which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/type which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/url_value which is a redirect
    • and 10 more flaws omitted

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

Labels

Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant