Skip to content

Commit a483742

Browse files
committed
Merge pull request #4 from ooHmartY/vendo-pseudo-elements
Solid work – thanks!
2 parents 4360279 + 844ff9b commit a483742

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default postcss.plugin('postcss-nested-props', () => {
1616

1717
const HAS_COLON = /:/;
1818
const ALL_PSEUDO = pseudoClasses().concat(pseudoElements());
19-
const HAS_PSEUDO_CLASSES_ELEMENTS = new RegExp(`:(${ALL_PSEUDO.join('|')})`);
19+
const VENDOR_PSEUDO_ELEMENTS = '-(\\w|-)+';
20+
const HAS_PSEUDO_CLASSES_ELEMENTS = new RegExp(`:(${ALL_PSEUDO.join('|')}|${VENDOR_PSEUDO_ELEMENTS})`);
2021

2122
function unwrapRule(namespace: string[], rule: postcss.Rule) {
2223
if (!HAS_COLON.test(rule.selector)) {

test/plugin.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ describe('postcss-nested-props plugin', () => {
6565
});
6666
});
6767

68+
describe('vendor pseudo elements', () => {
69+
[
70+
'-ms-clear',
71+
'-webkit-progress-bar',
72+
'-moz-focus-outer'
73+
].forEach(vendorPseudoElement => {
74+
it(`preserves the ::${vendorPseudoElement} pseudo-element`, () => {
75+
check(
76+
`a{b::${vendorPseudoElement}{c:d}}`,
77+
`a{b::${vendorPseudoElement}{c:d}}`
78+
);
79+
});
80+
});
81+
});
82+
6883
});
6984

7085
function check(input: string, output: string) {

0 commit comments

Comments
 (0)