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 {
201201}
202202
203203function parseClipPath ( value : string ) : string | ClipPathFunction {
204- const functionStartIndex = value . indexOf ( '(' ) ;
204+ const funcStartIndex = value . indexOf ( '(' ) ;
205+ const funcEndIndex = value . lastIndexOf ( ')' ) ;
205206
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 ( ) ;
208209
209210 switch ( functionName ) {
210211 case 'rect' :
211212 case 'circle' :
212213 case 'ellipse' :
213214 case 'polygon' :
214215 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 ) ) ;
217217 }
218218 default :
219219 throw new Error ( `Clip-path function ${ functionName } is not valid.` ) ;
You can’t perform that action at this time.
0 commit comments