From 52715e03b9cfee84c68fe343d784986bdaa3536c Mon Sep 17 00:00:00 2001 From: romainmenke Date: Thu, 31 Mar 2022 17:50:28 +0200 Subject: [PATCH 1/3] fix selector specificity display for :lang --- src/services/selectorPrinting.ts | 4 ++-- src/test/css/selectorPrinting.test.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/services/selectorPrinting.ts b/src/services/selectorPrinting.ts index 12e87856..edc1654b 100644 --- a/src/services/selectorPrinting.ts +++ b/src/services/selectorPrinting.ts @@ -388,7 +388,7 @@ export class SelectorPrinting { const text = element.getText(); if (this.isPseudoElementIdentifier(text)) { specificity.tag++; // pseudo element - break; + continue elementLoop; } // where and child selectors have zero specificity @@ -438,7 +438,7 @@ export class SelectorPrinting { } specificity.attr++; //pseudo class - break; + continue elementLoop; } if (element.getChildren().length > 0) { diff --git a/src/test/css/selectorPrinting.test.ts b/src/test/css/selectorPrinting.test.ts index 3c0fe63a..b0c59523 100644 --- a/src/test/css/selectorPrinting.test.ts +++ b/src/test/css/selectorPrinting.test.ts @@ -297,6 +297,11 @@ suite('CSS - MarkedStringPrinter selectors specificities', () => { '[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): (1, 1, 1)' ]); + assertSelectorMarkdown(p, '#s12:lang(en, fr)', '#s12', [ + { language: 'html', value: '' }, + '[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): (1, 1, 0)' + ]); + assertSelectorMarkdown(p, '#s12:is(foo > foo, :not(.bar > baz, :has(.bar > .baz)))', '#s12', [ { language: 'html', value: '' }, '[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): (1, 2, 0)' From ab5218e2b31e5c34a8449657322bdc5144ed4221 Mon Sep 17 00:00:00 2001 From: romainmenke Date: Thu, 31 Mar 2022 17:52:20 +0200 Subject: [PATCH 2/3] fix tests --- build/copy-jsbeautify.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/copy-jsbeautify.js b/build/copy-jsbeautify.js index 1af0b24c..402fd99e 100644 --- a/build/copy-jsbeautify.js +++ b/build/copy-jsbeautify.js @@ -16,6 +16,14 @@ function copy(from, to) { } } +if (!fs.existsSync(path.join(__dirname, '..', 'lib', 'umd'))) { + fs.mkdirSync(path.join(__dirname, '..', 'lib', 'umd')); +} + +if (!fs.existsSync(path.join(__dirname, '..', 'lib', 'esm'))) { + fs.mkdirSync(path.join(__dirname, '..', 'lib', 'esm')); +} + const umdDir = path.join(__dirname, '..', 'lib', 'umd', 'beautify'); copy(path.join(__dirname, '..', 'src', 'beautify'), umdDir); From ff9426924533e7b6d1f7e3b1ff807ef8d802207e Mon Sep 17 00:00:00 2001 From: Romain Menke <11521496+romainmenke@users.noreply.github.com> Date: Fri, 8 Apr 2022 15:19:01 +0200 Subject: [PATCH 3/3] Update copy-jsbeautify.js --- build/copy-jsbeautify.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build/copy-jsbeautify.js b/build/copy-jsbeautify.js index 402fd99e..1af0b24c 100644 --- a/build/copy-jsbeautify.js +++ b/build/copy-jsbeautify.js @@ -16,14 +16,6 @@ function copy(from, to) { } } -if (!fs.existsSync(path.join(__dirname, '..', 'lib', 'umd'))) { - fs.mkdirSync(path.join(__dirname, '..', 'lib', 'umd')); -} - -if (!fs.existsSync(path.join(__dirname, '..', 'lib', 'esm'))) { - fs.mkdirSync(path.join(__dirname, '..', 'lib', 'esm')); -} - const umdDir = path.join(__dirname, '..', 'lib', 'umd', 'beautify'); copy(path.join(__dirname, '..', 'src', 'beautify'), umdDir);