The spec for this says:
If given as an <attr-unit> value, the value is first parsed as if type(<number>) was specified, then the resulting numeric value is turned into a dimension with the corresponding unit, or a percentage if % was given. Values that fail to parse as a <number> trigger fallback.
<number> can mean a literal number, but it can also be a math function, or various other functions that produce <number>. Chromium added a crash test which checks that a non-literal appearing doesn't break the browser:
<!DOCTYPE html>
<link rel="help" href="https://crbug.com/405422528">
<div data-crash="sibling-index()" style="width: attr(data-crash px)"></div>
<div data-crash="sign(1em - 1px)" style="width: attr(data-crash px)"></div>
But their fix assumes that only <number> literals are allowed.
The spec is ambiguous here. Only allowing literals is one interpretation (and certainly the easiest to implement!) but the other interpretation (which I read the spec as meaning) is that this:
<div data-crash="sign(1em - 1px)" style="width: attr(data-crash px)"></div>
...should produce a width value equivalent to calc(sign(1em - 1px) * 1px).
cc: @lilles
The spec for this says:
<number>can mean a literal number, but it can also be a math function, or various other functions that produce<number>. Chromium added a crash test which checks that a non-literal appearing doesn't break the browser:But their fix assumes that only
<number>literals are allowed.The spec is ambiguous here. Only allowing literals is one interpretation (and certainly the easiest to implement!) but the other interpretation (which I read the spec as meaning) is that this:
...should produce a
widthvalue equivalent tocalc(sign(1em - 1px) * 1px).cc: @lilles