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)'