cssstyle icon indicating copy to clipboard operation
cssstyle copied to clipboard

Color function values are not properly rounded

Open cdoublev opened this issue 3 years ago • 0 comments

This test expectation is wrong:

style.color = 'rgba(5%, 10%, 20%, 0.4)';
expect(style.color).toEqual('rgba(12, 25, 51, 0.4)');

In Chrome/Firefox:

target.style.backgroundColor = 'rgba(5%, 10%, 20%, 0.4)'
console.log(target.style.backgroundColor) // "rgba(13, 26, 51, 0.4)"

Spec:

Implementations should honor the precision of the channel as authored or calculated wherever possible. If this is not possible, the channel should be rounded towards +∞.

cdoublev avatar May 04 '21 08:05 cdoublev