File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -338,3 +338,17 @@ test(
338338 'calc( (1em - calc( 10px + 1em)) / 2)' ,
339339 '-5px'
340340)
341+
342+ test (
343+ 'should skip constant()' ,
344+ testFixture ,
345+ 'calc(constant(safe-area-inset-left))' ,
346+ 'calc(constant(safe-area-inset-left))'
347+ )
348+
349+ test (
350+ 'should skip env()' ,
351+ testFixture ,
352+ 'calc(env(safe-area-inset-left))' ,
353+ 'calc(env(safe-area-inset-left))'
354+ )
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ export default (value, precision = 5) => {
1414
1515 // stringify calc expression and produce an AST
1616 const contents = valueParser . stringify ( node . nodes )
17+
18+ // skip constant() and env()
19+ if ( contents . indexOf ( 'constant' ) >= 0 || contents . indexOf ( 'env' ) >= 0 ) return ;
20+
1721 const ast = parser . parse ( contents )
1822
1923 // reduce AST to its simplest form, that is, either to a single value
You can’t perform that action at this time.
0 commit comments