feat: improved serialization of the rotate property#1147
Open
yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
Open
feat: improved serialization of the rotate property#1147yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
rotate property#1147yisibl wants to merge 1 commit intoparcel-bundler:masterfrom
Conversation
This PR refactors the serialization of the `rotate` property value according to the CSS Transforms 2 specification. Previously, `rotate: 0deg` was incorrectly serialized as `rotate: none`. The specification clearly states that `rotate: 0deg` creates a stacking context and containing block, while `rotate: none` does not. See Demo: https://codepen.io/yisi/pen/QwEJEmr?editors=0100 > All three properties accept (and default to) the value none, which produces no transform at all. In particular, this value does not trigger the creation of a stacking context or containing block for all descendants, while all other values (including “identity” transforms like translate: 0px) create a stacking context and containing block for all descendants, per usual for transforms. > https://drafts.csswg.org/css-transforms-2/#valdef-translate-none This PR fixes this issue and also provides additional compression benefits. - `minify_test(".foo { rotate: -0deg }", ".foo{rotate:0deg}");` - `minify_test(".foo { rotate: z 10deg }", ".foo{rotate:10deg}");` - `minify_test(".foo { rotate: 0 0 1 10deg }", ".foo{rotate:10deg}");` - `minify_test(".foo { rotate: 10deg 0 0 -1 }", ".foo{rotate:-10deg}");` Fixes: parcel-bundler#1136
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.
This PR refactors the serialization of the
rotateproperty value according to the CSS Transforms 2 specification.Previously,
rotate: 0degwas incorrectly serialized asrotate: none. The specification clearly states thatrotate: 0degcreates a stacking context and containing block, whilerotate: nonedoes not.See Demo: https://codepen.io/yisi/pen/QwEJEmr?editors=0100

This PR fixes this issue and also provides additional compression benefits.
minify_test(".foo { rotate: -0deg }", ".foo{rotate:0deg}");minify_test(".foo { rotate: z 10deg }", ".foo{rotate:10deg}");minify_test(".foo { rotate: 0 0 1 10deg }", ".foo{rotate:10deg}");minify_test(".foo { rotate: 10deg 0 0 -1 }", ".foo{rotate:-10deg}");Fixes: #1136