lightningcss icon indicating copy to clipboard operation
lightningcss copied to clipboard

minifier: it is not safe to remove the default value of a function in filter

Open yisibl opened this issue 3 years ago • 1 comments

There are several inconsistencies in Chrome's implementation of defaults in older versions, which can cause filters to behave in opposite ways in older browsers. Perhaps other browsers have similar bugs with inconsistent defaults between old and new versions, I didn't continue searching.

Playground

Input

.foo {
  filter: brightness(1);
}

Output

.foo {
  -webkit-filter: brightness(); /* I'm also concerned that `-webkit-filter` does not support omitting the default values. */
  filter: brightness(); /* In older versions of Chrome, the calculated value is 0 */
}

Chrome bugs

  • https://bugs.chromium.org/p/chromium/issues/detail?id=964696#c13
  • https://bugs.chromium.org/p/chromium/issues/detail?id=798683#c6

I would recommend turning off arguments omitting of the functions in the filter by default, it's not worth sacrificing correctness for those few bytes.

yisibl avatar Aug 05 '22 09:08 yisibl

in cef which chromium version is 49, -webkit-filter:brightness(); caused a crash

we125182 avatar Sep 10 '25 08:09 we125182