This repository was archived by the owner on Jun 6, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change
1
+ # 1.0.2 - 2015-06-13
2
+
3
+ - Fixed: support of pseudo classes that use parenthesis
4
+
1
5
# 1.0.1 - 2015-04-30
2
6
3
7
- Fixed: the module now works in non babel environments
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " postcss-selector-not" ,
3
- "version" : " 1.0.1 " ,
3
+ "version" : " 1.0.2 " ,
4
4
"description" : " PostCSS plugin to transform :not() W3C CSS leve 4 pseudo class to :not() CSS level 3 selectors" ,
5
5
"keywords" : [
6
6
" postcss" ,
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ import list from "postcss/lib/list"
4
4
import balancedMatch from "balanced-match"
5
5
6
6
function explodeSelector ( pseudoClass , selector ) {
7
- if ( selector && selector . indexOf ( pseudoClass ) > - 1 ) {
8
- const start = ` ${ pseudoClass } (`
9
- const end = ")"
10
- const matches = balancedMatch ( start , end , selector )
7
+ const position = selector . indexOf ( pseudoClass )
8
+ if ( selector && position > - 1 ) {
9
+ const pre = selector . slice ( 0 , position )
10
+ const matches = balancedMatch ( "(" , ")" , selector . slice ( position ) )
11
11
const selectors = [ ]
12
12
const bodySelectors = matches . body ?
13
13
list
@@ -17,7 +17,7 @@ function explodeSelector(pseudoClass, selector) {
17
17
const postSelectors = matches . post ? explodeSelector ( pseudoClass , matches . post ) : [ "" ]
18
18
postSelectors . forEach ( postSelector => {
19
19
bodySelectors . forEach ( bodySelector => {
20
- selectors . push ( `${ matches . pre } ${ pseudoClass } (${ bodySelector } )${ postSelector } ` )
20
+ selectors . push ( `${ pre } ${ pseudoClass } (${ bodySelector } )${ postSelector } ` )
21
21
} )
22
22
} )
23
23
return selectors
Original file line number Diff line number Diff line change @@ -50,5 +50,11 @@ tape("postcss-selector-not", t => {
50
50
"should transform :not() recursively"
51
51
)
52
52
53
+ t . equal (
54
+ transform ( ".foo:not(:nth-child(-n+2), .bar) {}" ) ,
55
+ ".foo:not(:nth-child(-n+2)), .foo:not(.bar) {}" ,
56
+ "should transform childs with parenthesis"
57
+ )
58
+
53
59
t . end ( )
54
60
} )
You can’t perform that action at this time.
0 commit comments