File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,12 @@ function localizeDeclNode(node, context) {
204
204
return node ;
205
205
}
206
206
207
+ function isWordAFunctionArgument ( wordNode , functionNode ) {
208
+ return functionNode
209
+ ? functionNode . nodes . some ( functionNodeChild => functionNodeChild . sourceIndex === wordNode . sourceIndex )
210
+ : false
211
+ }
212
+
207
213
function localizeAnimationShorthandDeclValues ( decl , context ) {
208
214
const validIdent = / ^ - ? [ _ a - z ] [ _ a - z 0 - 9 - ] * $ / i;
209
215
@@ -244,13 +250,19 @@ function localizeAnimationShorthandDeclValues(decl, context) {
244
250
245
251
const didParseAnimationName = false ;
246
252
let parsedAnimationKeywords = { } ;
253
+ let stepsFunctionNode = null ;
247
254
const valueNodes = valueParser ( decl . value ) . walk ( ( node ) => {
248
255
/* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
249
256
if ( node . type === 'div' ) {
250
257
parsedAnimationKeywords = { } ;
251
258
}
259
+ if ( node . type === 'function' && node . value . toLowerCase ( ) === 'steps' ) {
260
+ stepsFunctionNode = node ;
261
+ }
252
262
const value =
253
- node . type === 'word' ? node . value . toLowerCase ( ) : null ;
263
+ node . type === 'word' && ! isWordAFunctionArgument ( node , stepsFunctionNode )
264
+ ? node . value . toLowerCase ( )
265
+ : null ;
254
266
255
267
let shouldParseAnimationName = false ;
256
268
Original file line number Diff line number Diff line change @@ -198,6 +198,23 @@ const tests = [
198
198
expected :
199
199
':local(.foo) { animation: :local(slide-right) 300ms forwards ease-out, :local(fade-in) 300ms forwards ease-out; }'
200
200
} ,
201
+ {
202
+ should :
203
+ 'not treat "start" and "end" keywords in steps() function as identifiers' ,
204
+ input : [
205
+ '.foo { animation: spin 1s steps(12, end) infinite; }' ,
206
+ '.foo { animation: spin 1s STEPS(12, start) infinite; }' ,
207
+ '.foo { animation: spin 1s steps(12, END) infinite; }' ,
208
+ '.foo { animation: spin 1s steps(12, START) infinite; }' ,
209
+ ] . join ( '\n' ) ,
210
+ expected :
211
+ [
212
+ ':local(.foo) { animation: :local(spin) 1s steps(12, end) infinite; }' ,
213
+ ':local(.foo) { animation: :local(spin) 1s STEPS(12, start) infinite; }' ,
214
+ ':local(.foo) { animation: :local(spin) 1s steps(12, END) infinite; }' ,
215
+ ':local(.foo) { animation: :local(spin) 1s steps(12, START) infinite; }'
216
+ ] . join ( '\n' ) ,
217
+ } ,
201
218
{
202
219
should : 'handle animations with custom timing functions' ,
203
220
input :
You can’t perform that action at this time.
0 commit comments