From 9696e0b3780ede9bb59ab3cf3bf4f2df179d0b32 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Tue, 22 Oct 2024 01:57:58 -0700 Subject: [PATCH] fix(ext/console): ignore casing for named colors in css parsing (#26466) --- ext/console/01_console.js | 1 + tests/unit/console_test.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 3c07cf64aa..3803492b90 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -2653,6 +2653,7 @@ const HSL_PATTERN = new SafeRegExp( ); function parseCssColor(colorString) { + colorString = StringPrototypeToLowerCase(colorString); if (colorKeywords.has(colorString)) { colorString = colorKeywords.get(colorString); } diff --git a/tests/unit/console_test.ts b/tests/unit/console_test.ts index 42cff7c705..06f5dd7e61 100644 --- a/tests/unit/console_test.ts +++ b/tests/unit/console_test.ts @@ -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]);