[csswg-drafts] [css-values-5] Make attr() fallback empty string if omitted (#11818)

tursunova has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values-5] Make attr() fallback empty string if omitted ==
The new `attr()` behavior is inconsistent with the old one when attribute does not exist, new `attr()` will be IACVT and the old one would produce an empty string.

This is consistent with behavior of substitution functions in general, but since it's a breaking change, our users see this as a [regression](https://buganizer.corp.google.com/issues/396334721). Example:
```
<style> 
  div::after { content: attr(data-text); }
</style>
<div>Test</div>
```
While with old `attr()` behavior the pseudo element `::after` with empty content will be created, with the new one the `attr() ` would be IACVT and hence the pseudo element would not be created.

Proposing the following spec changes to [7.7.1. Attribute Value Substitution](https://drafts.csswg.org/css-values-5/#attr-substitution):

> If there is no attribute named _attr name_ on _el_ and the _fallback_ is omitted, return an empty string.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11818 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 4 March 2025 12:27:52 UTC