Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patterns for translate(x[,y,z]) and translateX(x) #45

Merged
merged 2 commits into from Feb 25, 2017

Conversation

edg2s
Copy link
Member

@edg2s edg2s commented Jan 19, 2017

No description provided.

@Krinkle
Copy link
Member

Krinkle commented Jan 25, 2017

I'll first add a visual test on the demo to make it easier to see the problem and confirm the fix.

@edg2s
Copy link
Member Author

edg2s commented Jan 25, 2017

Visual test?

Krinkle added a commit to cssjanus/cssjanus.github.io that referenced this pull request Jan 25, 2017
@Krinkle
Copy link
Member

Krinkle commented Jan 25, 2017

See https://cssjanus.github.io/demo/. I've verified the fix to behave as one would expected (the current demo shows that it isn't being flipped). Sometimes the flipping of the values is not entirely intuitive. A visual confirmation makes it easier to review.

@Krinkle
Copy link
Member

Krinkle commented Jan 25, 2017

We may want to limit this to values in transforms, but then we need to take care to properly support multiple values as well such as transform: rotate(10deg) translateX(10px) translateY(5px);.

@yonatan
Copy link

yonatan commented Jan 26, 2017

For multiple arbitrary transformations (rotate, skew, matrix, etc) something like "transform: scaleX(-1) [original transformations] scaleX(-1)" should do the trick. As in:

LTR: http://codepen.io/anon/pen/WRZJyK
RTL: http://codepen.io/anon/pen/dNVejp

The transform-origin property can be a problem when unit lengths are involved. Might be possible with CSS calc.

@edg2s
Copy link
Member Author

edg2s commented Jan 27, 2017

We should also tag 1.1.4 so PHP can use the new tests.

Copy link
Member

@Krinkle Krinkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If infeasible or needlessly complex, I'm willing to reconsider. But I'd prefer to be a bit more future-proof and avoiding false-positives by limiting this to matches on property transform: instead of just anywhere.

Our current regex-based approach is already a bit fragile and prone to false-positives (especially in freeform strings), but I'd like to limit that as much as we can with little effort.

@edg2s
Copy link
Member Author

edg2s commented Feb 25, 2017

Added match for transform property - this now only matches one 'transform' per rule, but having multiple transformX's or a transform+transformX would be nonsensical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants