File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -201,19 +201,19 @@ function isNonNegativeFiniteNumber(value: number): boolean {
201
201
}
202
202
203
203
function parseClipPath ( value : string ) : string | ClipPathFunction {
204
- const functionStartIndex = value . indexOf ( '(' ) ;
204
+ const funcStartIndex = value . indexOf ( '(' ) ;
205
+ const funcEndIndex = value . lastIndexOf ( ')' ) ;
205
206
206
- if ( functionStartIndex > - 1 ) {
207
- const functionName = value . substring ( 0 , functionStartIndex ) . trim ( ) ;
207
+ if ( funcStartIndex > - 1 && funcEndIndex > - 1 ) {
208
+ const functionName = value . substring ( 0 , funcStartIndex ) . trim ( ) ;
208
209
209
210
switch ( functionName ) {
210
211
case 'rect' :
211
212
case 'circle' :
212
213
case 'ellipse' :
213
214
case 'polygon' :
214
215
case 'inset' : {
215
- const rule : string = value . replace ( `${ functionName } (` , '' ) . replace ( ')' , '' ) ;
216
- return new ClipPathFunction ( functionName , rule ) ;
216
+ return new ClipPathFunction ( functionName , value . substring ( funcStartIndex + 1 , funcEndIndex ) ) ;
217
217
}
218
218
default :
219
219
throw new Error ( `Clip-path function ${ functionName } is not valid.` ) ;
You can’t perform that action at this time.
0 commit comments