Skip to content

Commit

Permalink
Space -> WhiteSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Feb 8, 2017
1 parent f217458 commit 58986b7
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module.exports = function cleanWhitespace(node, item, list) {
return;
}

if (item.prev !== null && item.prev.data.type === 'Space') {
if (item.prev !== null && item.prev.data.type === 'WhiteSpace') {
list.remove(item.prev);
}

if (item.next !== null && item.next.data.type === 'Space') {
if (item.next !== null && item.next.data.type === 'WhiteSpace') {
list.remove(item.next);
}
};
2 changes: 1 addition & 1 deletion lib/compressor/clean/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var handlers = {
Declaration: require('./Declaration'),
TypeSelector: require('./TypeSelector'),
Comment: require('./Comment'),
Operator: require('./Space')
Operator: require('./WhiteSpace')
};

module.exports = function(ast, usageData) {
Expand Down
4 changes: 2 additions & 2 deletions lib/compressor/compress/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ function compressFunction(node, item, list) {

// check if color is not at the end and not followed by space
var next = item.next;
if (next && next.data.type !== 'Space') {
if (next && next.data.type !== 'WhiteSpace') {
list.insert(list.createItem({
type: 'Space',
type: 'WhiteSpace',
value: ' '
}), next);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/compressor/compress/property/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function compressBackground(node) {
}

function flush() {
if (lastType() === 'Space') {
if (lastType() === 'WhiteSpace') {
buffer.pop();
}

Expand All @@ -20,7 +20,7 @@ module.exports = function compressBackground(node) {
value: '0'
},
{
type: 'Space',
type: 'WhiteSpace',
value: ' '
},
{
Expand Down Expand Up @@ -57,7 +57,7 @@ module.exports = function compressBackground(node) {
}

// don't add redundant spaces
if (node.type === 'Space' && (!buffer.length || lastType() === 'Space')) {
if (node.type === 'WhiteSpace' && (!buffer.length || lastType() === 'WhiteSpace')) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/compressor/compress/property/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module.exports = function compressFont(node) {

// remove redundant spaces
list.each(function(node, item) {
if (node.type === 'Space') {
if (!item.prev || !item.next || item.next.data.type === 'Space') {
if (node.type === 'WhiteSpace') {
if (!item.prev || !item.next || item.next.data.type === 'WhiteSpace') {
this.remove(item);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/compressor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function readChunk(children, specialComments) {
return;
}

if (node.type !== 'Space') {
if (node.type !== 'WhiteSpace') {
nonSpaceTokenInBuffer = true;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/compressor/restructure/4-restructShorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ TRBL.prototype.getValueSequence = function(declaration, count) {
special = child.name;
break;

case 'Space':
case 'WhiteSpace':
return false; // ignore space

default:
Expand Down Expand Up @@ -296,14 +296,14 @@ TRBL.prototype.getValue = function() {

for (var i = 0; i < values.length; i++) {
if (i) {
result.appendData({ type: 'Space', value: ' ' });
result.appendData({ type: 'WhiteSpace', value: ' ' });
}

result.appendData(values[i].node);
}

if (this.iehack) {
result.appendData({ type: 'Space', value: ' ' });
result.appendData({ type: 'WhiteSpace', value: ' ' });
result.appendData({
type: 'Identifier',
loc: null,
Expand Down
3 changes: 1 addition & 2 deletions lib/compressor/restructure/6-restructBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ var NEEDLESS_TABLE = {
function getPropertyFingerprint(propertyName, declaration, fingerprints) {
var realName = resolveProperty(propertyName).name;

if (realName === 'background' ||
(realName === 'filter' && declaration.value.children.first().type === 'Progid')) {
if (realName === 'background') {
return propertyName + ':' + translate(declaration.value);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/compressor/restructure/prepare/processSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = function freeze(node, usageData) {
}
break;

case 'Space':
case 'WhiteSpace':
case 'Combinator':
tagName = '*';
break;
Expand Down

0 comments on commit 58986b7

Please sign in to comment.