From a0c973a8cd3892fb7948280defa5912b136dc27a Mon Sep 17 00:00:00 2001 From: Aleks Hudochenkov Date: Wed, 17 Feb 2016 11:19:13 +0300 Subject: [PATCH] Fix 1px rounding issue for flexbox grids in Safari #260 --- lib/lost-column.js | 11 ++--------- lib/lost-waffle.js | 4 ++-- test/lost-column.js | 3 +-- test/lost-waffle.js | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/lost-column.js b/lib/lost-column.js index 1b3ed54f..1bab6315 100644 --- a/lib/lost-column.js +++ b/lib/lost-column.js @@ -106,18 +106,11 @@ module.exports = function lostColumnDecl(css, settings) { newBlock( decl, ':nth-child('+ lostColumnCycle +'n)', - ['margin-right'], - [0] + ['margin-right', 'margin-left'], + [0, 'auto'] ); } - newBlock( - decl, - ':nth-child('+ lostColumnCycle +'n)', - ['float'], - ['right'] - ); - newBlock( decl, ':last-child', diff --git a/lib/lost-waffle.js b/lib/lost-waffle.js index 1a4e85cf..1e8f69bd 100644 --- a/lib/lost-waffle.js +++ b/lib/lost-waffle.js @@ -111,8 +111,8 @@ module.exports = function lostWaffleDecl(css, settings) { newBlock( decl, ':nth-child('+ lostWaffleCycle + 'n)', - ['margin-right', 'float'], - [0, 'right'] + ['margin-right', 'margin-left'], + [0, 'auto'] ); } diff --git a/test/lost-column.js b/test/lost-column.js index d272ad8e..7237913b 100644 --- a/test/lost-column.js +++ b/test/lost-column.js @@ -54,8 +54,7 @@ describe('lost-column', function() { ' }\n' + 'a:nth-child(1n) { margin-right: 60px; }\n' + 'a:last-child { margin-right: 0; }\n' + - 'a:nth-child(3n) { float: right; }\n' + - 'a:nth-child(3n) { margin-right: 0; }' + 'a:nth-child(3n) { margin-right: 0; margin-left: auto; }' ); }); it('provides none rule', function() { diff --git a/test/lost-waffle.js b/test/lost-waffle.js index fe7f326f..6255fb57 100644 --- a/test/lost-waffle.js +++ b/test/lost-waffle.js @@ -52,7 +52,7 @@ describe('lost-waffle', function() { ' height: calc(99.999999% * 2/5); }\n' + 'a:nth-child(1n) { margin-right: 0; margin-bottom: 0; }\n' + 'a:last-child { margin-right: 0; margin-bottom: 0; }\n' + - 'a:nth-child(3n) { margin-right: 0; float: right; }\n' + + 'a:nth-child(3n) { margin-right: 0; margin-left: auto; }\n' + 'a:nth-last-child(-n + 3) { margin-bottom: 0; }' ); });