From 878d82cd226d96dd5c6dd36cdcdd10cdbd963ee8 Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Thu, 27 Oct 2022 22:27:10 +0200 Subject: [PATCH] Ignore CSS Custom Properties on prefix in value lookup --- lib/declaration.js | 2 +- test/cases/user-select.css | 4 ++++ test/cases/user-select.out.css | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/declaration.js b/lib/declaration.js index 180696b63..0f86c30d2 100644 --- a/lib/declaration.js +++ b/lib/declaration.js @@ -33,7 +33,7 @@ class Declaration extends Prefixer { continue } if (value.includes(other)) { - return true + return value.replace(/var\([^)]+\)/, '').includes(other) } } return false diff --git a/test/cases/user-select.css b/test/cases/user-select.css index a48d1fae7..7a97e3e2a 100644 --- a/test/cases/user-select.css +++ b/test/cases/user-select.css @@ -9,3 +9,7 @@ b { .all { user-select: all; } + +.var { + user-select: var(--o-select); +} diff --git a/test/cases/user-select.out.css b/test/cases/user-select.out.css index 24f6a713f..d4e815e1a 100644 --- a/test/cases/user-select.out.css +++ b/test/cases/user-select.out.css @@ -14,3 +14,9 @@ b { -webkit-user-select: all; user-select: all; } + +.var { + -webkit-user-select: var(--o-select); + -ms-user-select: var(--o-select); + user-select: var(--o-select); +}