File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,17 @@ function localizeDeclValue(valueNode, context) {
185
185
function localizeAnimationShorthandDeclValueNodes ( nodes , context ) {
186
186
var validIdent = validIdent = / ^ - ? [ _ a - z ] [ _ a - z 0 - 9 - ] * $ / i;
187
187
188
+ /*
189
+ The spec defines some keywords that you can use to describe properties such as the timing
190
+ function. These are still valid animation names, so as long as there is a property that accepts
191
+ a keyword, it is given priority. Only when all the properties that can take a keyword are
192
+ exhausted can the animation name be set to the keyword. I.e.
193
+
194
+ animation: infinite infinite;
195
+
196
+ The animation will repeat an infinite number of times from the first argument, and will have an
197
+ animation name of infinite from the second.
198
+ */
188
199
var animationKeywords = {
189
200
'alternate' : 1 ,
190
201
'alternate-reverse' : 1 ,
@@ -197,13 +208,16 @@ function localizeAnimationShorthandDeclValueNodes(nodes, context) {
197
208
'forwards' : 1 ,
198
209
'infinite' : 1 ,
199
210
'linear' : 1 ,
200
- 'none' : 2 ,
211
+ 'none' : Infinity , // No matter how many times you write none, it will never be an animation name
201
212
'normal' : 1 ,
202
213
'paused' : 1 ,
203
214
'reverse' : 1 ,
204
215
'running' : 1 ,
205
216
'step-end' : 1 ,
206
217
'step-start' : 1 ,
218
+ 'initial' : Infinity ,
219
+ 'inherit' : Infinity ,
220
+ 'unset' : Infinity ,
207
221
} ;
208
222
209
223
var didParseAnimationName = false ;
Original file line number Diff line number Diff line change @@ -194,6 +194,11 @@ var tests = [
194
194
input : '.foo { animation: 1s infinite infinite; }' ,
195
195
expected : ':local(.foo) { animation: 1s infinite :local(infinite); }'
196
196
} ,
197
+ {
198
+ should : 'handle not localize an animation shorthand value of "inherit"' ,
199
+ input : '.foo { animation: inherit; }' ,
200
+ expected : ':local(.foo) { animation: inherit; }'
201
+ } ,
197
202
{
198
203
should : 'default to global when mode provided' ,
199
204
input : '.foo {}' ,
You can’t perform that action at this time.
0 commit comments