feat(minify): avoid removing the default value of the filter function#1121
Open
yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
Open
feat(minify): avoid removing the default value of the filter function#1121yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
filter function#1121yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
Conversation
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
Contributor
Author
|
@devongovett PTAL |
Member
|
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. |
Contributor
Author
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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