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+
15# 1.0.1 - 2015-04-30
26
37- Fixed: the module now works in non babel environments
Original file line number Diff line number Diff line change 11{
22 "name" : " postcss-selector-not" ,
3- "version" : " 1.0.1 " ,
3+ "version" : " 1.0.2 " ,
44 "description" : " PostCSS plugin to transform :not() W3C CSS leve 4 pseudo class to :not() CSS level 3 selectors" ,
55 "keywords" : [
66 " postcss" ,
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ import list from "postcss/lib/list"
44import balancedMatch from "balanced-match"
55
66function 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 ) )
1111 const selectors = [ ]
1212 const bodySelectors = matches . body ?
1313 list
@@ -17,7 +17,7 @@ function explodeSelector(pseudoClass, selector) {
1717 const postSelectors = matches . post ? explodeSelector ( pseudoClass , matches . post ) : [ "" ]
1818 postSelectors . forEach ( postSelector => {
1919 bodySelectors . forEach ( bodySelector => {
20- selectors . push ( `${ matches . pre } ${ pseudoClass } (${ bodySelector } )${ postSelector } ` )
20+ selectors . push ( `${ pre } ${ pseudoClass } (${ bodySelector } )${ postSelector } ` )
2121 } )
2222 } )
2323 return selectors
Original file line number Diff line number Diff line change @@ -50,5 +50,11 @@ tape("postcss-selector-not", t => {
5050 "should transform :not() recursively"
5151 )
5252
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+
5359 t . end ( )
5460} )
You can’t perform that action at this time.
0 commit comments