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) {
185185function localizeAnimationShorthandDeclValueNodes ( nodes , context ) {
186186 var validIdent = validIdent = / ^ - ? [ _ a - z ] [ _ a - z 0 - 9 - ] * $ / i;
187187
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+ */
188199 var animationKeywords = {
189200 'alternate' : 1 ,
190201 'alternate-reverse' : 1 ,
@@ -197,13 +208,16 @@ function localizeAnimationShorthandDeclValueNodes(nodes, context) {
197208 'forwards' : 1 ,
198209 'infinite' : 1 ,
199210 'linear' : 1 ,
200- 'none' : 2 ,
211+ 'none' : Infinity , // No matter how many times you write none, it will never be an animation name
201212 'normal' : 1 ,
202213 'paused' : 1 ,
203214 'reverse' : 1 ,
204215 'running' : 1 ,
205216 'step-end' : 1 ,
206217 'step-start' : 1 ,
218+ 'initial' : Infinity ,
219+ 'inherit' : Infinity ,
220+ 'unset' : Infinity ,
207221 } ;
208222
209223 var didParseAnimationName = false ;
Original file line number Diff line number Diff line change @@ -194,6 +194,11 @@ var tests = [
194194 input : '.foo { animation: 1s infinite infinite; }' ,
195195 expected : ':local(.foo) { animation: 1s infinite :local(infinite); }'
196196 } ,
197+ {
198+ should : 'handle not localize an animation shorthand value of "inherit"' ,
199+ input : '.foo { animation: inherit; }' ,
200+ expected : ':local(.foo) { animation: inherit; }'
201+ } ,
197202 {
198203 should : 'default to global when mode provided' ,
199204 input : '.foo {}' ,
You can’t perform that action at this time.
0 commit comments