From 762cd17525aaa99e2925f310f2137040ddf288da Mon Sep 17 00:00:00 2001 From: Jon Uhlmann Date: Wed, 1 Mar 2023 22:51:39 +0100 Subject: [PATCH 1/2] Use class selector instead of attribute selector --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index bf2b1a1..6bba175 100644 --- a/src/index.js +++ b/src/index.js @@ -19,10 +19,10 @@ function inWhere(selector, { className, modifier, prefix }) { let [trailingPseudo, rebuiltSelector] = commonTrailingPseudos(selector) if (trailingPseudo) { - return `:where(${selectorPrefix}${rebuiltSelector}):not(:where([class~="${prefixedNot}"] *))${trailingPseudo}` + return `:where(${selectorPrefix}${rebuiltSelector}):not(:where(.${prefixedNot} *))${trailingPseudo}` } - return `:where(${selectorPrefix}${selector}):not(:where([class~="${prefixedNot}"] *))` + return `:where(${selectorPrefix}${selector}):not(:where(.${prefixedNot} *))` } function isObject(value) { @@ -103,7 +103,7 @@ module.exports = plugin.withOptions( ['img'], ['video'], ['hr'], - ['lead', '[class~="lead"]'], + ['lead', '.lead'], ]) { selectors = selectors.length === 0 ? [name] : selectors From 6abea0a093216cb2d494077347fc05b9bc3c9ac7 Mon Sep 17 00:00:00 2001 From: Jon Uhlmann Date: Wed, 1 Mar 2023 22:52:28 +0100 Subject: [PATCH 2/2] Ignore not-prose element itself Closes #299 --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 6bba175..cb11934 100644 --- a/src/index.js +++ b/src/index.js @@ -19,10 +19,10 @@ function inWhere(selector, { className, modifier, prefix }) { let [trailingPseudo, rebuiltSelector] = commonTrailingPseudos(selector) if (trailingPseudo) { - return `:where(${selectorPrefix}${rebuiltSelector}):not(:where(.${prefixedNot} *))${trailingPseudo}` + return `:where(${selectorPrefix}${rebuiltSelector}):not(:where(.${prefixedNot},.${prefixedNot} *))${trailingPseudo}` } - return `:where(${selectorPrefix}${selector}):not(:where(.${prefixedNot} *))` + return `:where(${selectorPrefix}${selector}):not(:where(.${prefixedNot},.${prefixedNot} *))` } function isObject(value) {