Skip to content

Commit

Permalink
Make sure comma exists
Browse files Browse the repository at this point in the history
Otherwise, if a new syntax such as 'rgb(128 128 128 / 0.5)' is passed, the value will be returned as is.
  • Loading branch information
asamuzaK committed Jan 27, 2024
1 parent 2c6f2bd commit a7bbf06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jsdom/living/helpers/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function sharedSpecifiedAndComputedAndUsed(color) {
return hexToRGBA(color.slice(1));
}

if (/^rgba?\(/.test(color)) {
if (/^rgba?\(/.test(color) && color.includes(",")) {
return color.split(",").map(s => s.trim()).join(", ");
}

Expand Down

0 comments on commit a7bbf06

Please sign in to comment.