Skip to content

Commit

Permalink
Checking if var() is computationally independent is useless
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoublev committed Oct 12, 2024
1 parent 035da2e commit b7302ce
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/parse/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@ function isComputationallyIndependent(initial) {
if (Array.isArray(initial)) {
return initial.every(isComputationallyIndependent)
}
const { name, types, value, unit } = initial
if (name) {
return name !== 'var' && isComputationallyIndependent(value)
}
// <calc-*>
if (Array.isArray(value)) {
return value.every(isComputationallyIndependent)
const { types, value, unit } = initial
if (types[0] === '<function>') {
return isComputationallyIndependent(value)
}
if (types[0] === '<dimension-token>') {
return !computationallyDependentUnits.includes(unit)
}
if (Array.isArray(value)) {
return value.every(isComputationallyIndependent)
}
return true
}

Expand Down

0 comments on commit b7302ce

Please sign in to comment.