Skip to content

Commit 9a523b5

Browse files
committed
Do not prefix modern animation-direction values
1 parent 178547b commit 9a523b5

5 files changed

Lines changed: 41 additions & 0 deletions

File tree

lib/hacks/animation.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const Declaration = require('../declaration');
2+
3+
class Animation extends Declaration {
4+
5+
static names = ['animation', 'animation-direction'];
6+
7+
/**
8+
* Don’t add prefixes for modern values.
9+
*/
10+
check(decl) {
11+
return !decl.value.split(/\s+/).find(i => {
12+
const lower = i.toLowerCase();
13+
return lower === 'reverse' || lower === 'alternate-reverse';
14+
});
15+
}
16+
17+
}
18+
19+
module.exports = Animation;

lib/prefixes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Declaration.hack(require('./hacks/flex'));
1818
Declaration.hack(require('./hacks/order'));
1919
Declaration.hack(require('./hacks/filter'));
2020
Declaration.hack(require('./hacks/grid-end'));
21+
Declaration.hack(require('./hacks/animation'));
2122
Declaration.hack(require('./hacks/flex-flow'));
2223
Declaration.hack(require('./hacks/flex-grow'));
2324
Declaration.hack(require('./hacks/flex-wrap'));

test/autoprefixer.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ describe('hacks', () => {
379379
it('supports cross-fade()', () => test('cross-fade'));
380380
it('supports grid layout', () => test('grid'));
381381
it('supports text-decoration', () => test('text-decoration'));
382+
it('ignores modern direction', () => test('animation'));
382383

383384
it('supports appearance for IE', () => {
384385
const instance = autoprefixer({ browsers: 'Edge 15' });

test/cases/animation.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
a {
2+
animation-direction: alternate;
3+
animation-direction: reverse;
4+
animation-direction: REVERSE;
5+
animation-direction: alternate-reverse;
6+
animation: rotation-reverse;
7+
animation: rotation-reverse reverse;
8+
}

test/cases/animation.out.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
a {
2+
-webkit-animation-direction: alternate;
3+
-o-animation-direction: alternate;
4+
animation-direction: alternate;
5+
animation-direction: reverse;
6+
animation-direction: REVERSE;
7+
animation-direction: alternate-reverse;
8+
-webkit-animation: rotation-reverse;
9+
-o-animation: rotation-reverse;
10+
animation: rotation-reverse;
11+
animation: rotation-reverse reverse;
12+
}

0 commit comments

Comments
 (0)