feat(minify): avoid removing the default value of the filter function#1121
feat(minify): avoid removing the default value of the filter function#1121yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
filter function#1121Conversation
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.
In older versions of Chrome(49), `-webkit-filter: brightness()` also caused crashes.
```css
.foo {
filter: brightness(1);
}
```
```css
.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 */
}
```
- 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.
Fixed: parcel-bundler#251
|
@devongovett PTAL |
|
Chrome 49 is almost 10 years old so I doubt anyone is targeting that anymore. But we could potentially check the targets and see if the minimum version is below that. |
|
@devongovett Beyond the issue with .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 */
}When CSS authors explicitly write So, I still stand by my view: we really shouldn't obsess over reducing byte counts. Maintaining CSS correctness is far more important. |
|
CSS correctness is one thing. It is another thing entirely to account for 10 year old browser bugs. There is no source of truth for that. When implementing things we need to rely on the spec being correct, otherwise the job is not possible. |
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.
In older versions of Chrome(49),
-webkit-filter: brightness()also caused crashes.Input
Output
I would recommend turning off arguments omitting of the functions in the
filterby default, it's not worth sacrificing correctness for those few bytes.Fixed: #251