Skip to content

Commit

Permalink
review fixes for spaces around selector delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
vecmezoni authored and tonyganch committed Jun 9, 2014
1 parent 96afced commit 0a66102
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion doc/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ a, b {
}
```

Example: `{ 'space-before-selector-delimiter': '\n' }`
Example: `{ 'space-after-selector-delimiter': '\n' }`

```scss
// Before:
Expand Down
12 changes: 6 additions & 6 deletions lib/options/space-after-selector-delimiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ module.exports = {
var value = this.getValue('space-after-selector-delimiter');

for (var i = node.length; i--;) {
if (node[i][0] === 'delim') {
if (node[i + 1][1][0] === 's') {
node[i + 1][1][1] = value;
} else {
node[i + 1].splice(1, 0, ['s', value]);
}
if (node[i][0] !== 'delim') continue;

if (node[i + 1][1][0] === 's') {
node[i + 1][1][1] = value;
} else {
node[i + 1].splice(1, 0, ['s', value]);
}
}
},
Expand Down
18 changes: 10 additions & 8 deletions lib/options/space-before-selector-delimiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ module.exports = {
var value = this.getValue('space-before-selector-delimiter');

for (var i = node.length; i--;) {
if (node[i][0] === 'delim') {
if (node[i - 1][node[i - 1].length - 1][0] === 's') {
node[i - 1][node[i - 1].length - 1][1] = value;
} else {
node[i - 1].push(['s', value]);
}
if (node[i][0] !== 'delim') continue;

var previousNode = node[i - 1];
if (previousNode[previousNode.length - 1][0] === 's') {
previousNode[previousNode.length - 1][1] = value;
} else {
previousNode.push(['s', value]);
}
}
},
Expand All @@ -42,8 +43,9 @@ module.exports = {
for (var i = node.length; i--;) {
if (node[i][0] !== 'delim') continue;

if (node[i - 1][node[i - 1].length - 1][0] === 's') {
variants.push(node[i - 1][node[i - 1].length - 1][1]);
var previousNode = node[i - 1];
if (previousNode[previousNode.length - 1][0] === 's') {
variants.push(previousNode[previousNode.length - 1][1]);
} else {
variants.push('');
}
Expand Down

0 comments on commit 0a66102

Please sign in to comment.