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(
338
338
'calc( (1em - calc( 10px + 1em)) / 2)' ,
339
339
'-5px'
340
340
)
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) => {
14
14
15
15
// stringify calc expression and produce an AST
16
16
const contents = valueParser . stringify ( node . nodes )
17
+
18
+ // skip constant() and env()
19
+ if ( contents . indexOf ( 'constant' ) >= 0 || contents . indexOf ( 'env' ) >= 0 ) return ;
20
+
17
21
const ast = parser . parse ( contents )
18
22
19
23
// 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