Speed up CSS math function check (#12215)
* perf(cssMathFnRE): Dynamically create regular rules * Cleanup code --------- Co-authored-by: Jordan Pittman <jordan@cryptica.me>
This commit is contained in:
parent
44fb67b98d
commit
e9ca7ab453
1 changed files with 2 additions and 1 deletions
|
|
@ -3,11 +3,12 @@ import { parseBoxShadowValue } from './parseBoxShadowValue'
|
|||
import { splitAtTopLevelOnly } from './splitAtTopLevelOnly'
|
||||
|
||||
let cssFunctions = ['min', 'max', 'clamp', 'calc']
|
||||
let IS_CSS_FN = new RegExp(`^(${cssFunctions.join('|')})\\(.*\\)`)
|
||||
|
||||
// Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
|
||||
|
||||
function isCSSFunction(value) {
|
||||
return cssFunctions.some((fn) => new RegExp(`^${fn}\\(.*\\)`).test(value))
|
||||
return IS_CSS_FN.test(value)
|
||||
}
|
||||
|
||||
// This is not a data type, but rather a function that can normalize the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue