fix(ext/console): ignore casing for named colors in css parsing (#26466)

This commit is contained in:
Leo Kettmeir 2024-10-22 01:57:58 -07:00 committed by GitHub
parent f26c8bcf31
commit 9696e0b378
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -2653,6 +2653,7 @@ const HSL_PATTERN = new SafeRegExp(
);
function parseCssColor(colorString) {
colorString = StringPrototypeToLowerCase(colorString);
if (colorKeywords.has(colorString)) {
colorString = colorKeywords.get(colorString);
}

View File

@ -1227,6 +1227,7 @@ Deno.test(function consoleParseCssColor() {
assertEquals(parseCssColor("inherit"), null);
assertEquals(parseCssColor("black"), [0, 0, 0]);
assertEquals(parseCssColor("darkmagenta"), [139, 0, 139]);
assertEquals(parseCssColor("darkMaGenta"), [139, 0, 139]);
assertEquals(parseCssColor("slateblue"), [106, 90, 205]);
assertEquals(parseCssColor("#ffaa00"), [255, 170, 0]);
assertEquals(parseCssColor("#ffAA00"), [255, 170, 0]);