File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module.exports = {
77 * @returns {Object }
88 */
99 setValue : function ( value ) {
10+ this . _value = false ;
1011 if ( value === true ) this . _value = 'after' ;
1112 if ( typeof value === 'string' && value . match ( / a f t e r | b e f o r e | b o t h / ) ) this . _value = value ;
1213 if ( ! this . _value ) return ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module.exports = {
77 * @returns {Object }
88 */
99 setValue : function ( value ) {
10+ this . _value = false ;
1011 if ( value === true ) value = ' ' ;
1112 if ( typeof value === 'string' && value . match ( / ^ [ \t \n ] * $ / ) ) this . _value = value ;
1213 if ( ! this . _value ) return ;
@@ -19,9 +20,15 @@ module.exports = {
1920 * @param {node } node
2021 */
2122 process : function ( nodeType , node ) {
22- if ( nodeType === 'simpleselector' ) {
23- if ( node [ node . length - 1 ] [ 0 ] === 's' ) node . pop ( ) ;
24- node . push ( [ 's' , this . _value ] ) ;
23+ if ( nodeType === 'selector' ) {
24+ for ( var i = node . length ; i -- ; ) {
25+ var nodeItem = node [ i ] ;
26+ if ( nodeItem [ 0 ] === 'simpleselector' ) {
27+ if ( nodeItem [ nodeItem . length - 1 ] [ 0 ] === 's' ) nodeItem . pop ( ) ;
28+ nodeItem . push ( [ 's' , this . _value ] ) ;
29+ break ;
30+ }
31+ }
2532 }
2633 }
2734
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ describe('options/stick-brace', function() {
1818 assert . equal (
1919 comb . processString (
2020 'a { color: red }' +
21+ 'a,\nb /* i */\n{ color: red }' +
2122 'a{color:red}' +
2223 'a \t\t \n{color:red}' +
2324 'a /* foo */ {color:red}'
2425 ) ,
2526 'a { color: red }' +
27+ 'a,\nb /* i */ { color: red }' +
2628 'a {color:red}' +
2729 'a {color:red}' +
2830 'a /* foo */ {color:red}'
@@ -33,11 +35,13 @@ describe('options/stick-brace', function() {
3335 assert . equal (
3436 comb . processString (
3537 'a { color: red }' +
38+ 'a, b /* i */ { color: red }' +
3639 'a{color:red}' +
3740 'a \t\t \n{color:red}' +
3841 'a /* foo */ {color:red}'
3942 ) ,
4043 'a\n{ color: red }' +
44+ 'a, b /* i */\n{ color: red }' +
4145 'a\n{color:red}' +
4246 'a\n{color:red}' +
4347 'a /* foo */\n{color:red}'
You can’t perform that action at this time.
0 commit comments