@@ -198,16 +198,16 @@ function parseCSSLinearGradient(
198198 for ( const stop of stops ) {
199199 const trimmedStop = stop . trim ( ) . toLowerCase ( ) ;
200200 // Match function like pattern or single words
201- const parts = trimmedStop . match ( / \S + \( [ ^ ) ] * \) | \S + / g) ;
202- if ( parts == null ) {
201+ const colorStopParts = trimmedStop . match ( / \S + \( [ ^ ) ] * \) | \S + / g) ;
202+ if ( colorStopParts == null ) {
203203 // If a color stop is invalid, return an empty array and do not apply any gradient. Same as web.
204204 return [ ] ;
205205 }
206206 // Case 1: [color, position, position]
207- if ( parts . length === 3 ) {
208- const color = parts [ 0 ] ;
209- const position1 = parts [ 1 ] ;
210- const position2 = parts [ 2 ] ;
207+ if ( colorStopParts . length === 3 ) {
208+ const color = colorStopParts [ 0 ] ;
209+ const position1 = colorStopParts [ 1 ] ;
210+ const position2 = colorStopParts [ 2 ] ;
211211 const processedColor = processColor ( color ) ;
212212 if ( processedColor == null ) {
213213 // If a color is invalid, return an empty array and do not apply any gradient. Same as web.
@@ -228,9 +228,9 @@ function parseCSSLinearGradient(
228228 }
229229 }
230230 // Case 2: [color, position]
231- else if ( parts . length === 2 ) {
232- const color = parts [ 0 ] ;
233- const position = parts [ 1 ] ;
231+ else if ( colorStopParts . length === 2 ) {
232+ const color = colorStopParts [ 0 ] ;
233+ const position = colorStopParts [ 1 ] ;
234234 const processedColor = processColor ( color ) ;
235235 if ( processedColor == null ) {
236236 // If a color is invalid, return an empty array and do not apply any gradient. Same as web.
@@ -248,14 +248,14 @@ function parseCSSLinearGradient(
248248 }
249249 // Case 3: [color]
250250 // Case 4: [position] => transition hint syntax
251- else if ( parts . length === 1 ) {
252- if ( parts [ 0 ] . endsWith ( '% ') ) {
251+ else if ( colorStopParts . length === 1 ) {
252+ if ( colorStopParts [ 0 ] . endsWith ( '% ') ) {
253253 colorStops . push ( {
254254 color : null ,
255- position : parseFloat ( parts [ 0 ] ) / 100 ,
255+ position : parseFloat ( colorStopParts [ 0 ] ) / 100 ,
256256 } ) ;
257257 } else {
258- const processedColor = processColor ( parts [ 0 ] ) ;
258+ const processedColor = processColor ( colorStopParts [ 0 ] ) ;
259259 if ( processedColor == null ) {
260260 // If a color is invalid, return an empty array and do not apply any gradient. Same as web.
261261 return [ ] ;
0 commit comments