Skip to content

Commit dcb492a

Browse files
committed
Perform similar color matching on all properties with color in the name. Also, keep a whitelist that we can expand as cases come up.
1 parent 839733e commit dcb492a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

css-compare.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ function filterSimilarColors(patchLines) {
226226
// ...
227227
// ]
228228
const ALLOWED_PROPERTIES = [
229-
"color",
230-
"background-color",
229+
"border",
231230
];
232231
const lineFilter = (line) => {
233232
const rgbaCount = (line.text.match(/rgba\(/g) || []).length;
@@ -237,8 +236,9 @@ function filterSimilarColors(patchLines) {
237236
throw new Error("More than one rgba per line. Investigate!");
238237
}
239238

240-
return rgbaCount === 1 &&
241-
(match && ALLOWED_PROPERTIES.includes(match[1]));
239+
const allowedProperty = match && (match[1].includes("color") || ALLOWED_PROPERTIES.includes(match[1]));
240+
241+
return rgbaCount === 1 && allowedProperty;
242242
}
243243

244244
chunks.forEach((chunk) => {

0 commit comments

Comments
 (0)