less
Version:
Leaner CSS
24 lines (22 loc) • 668 B
JavaScript
var Node = require("./node");
var Combinator = function (value) {
if (value === ' ') {
this.value = ' ';
this.emptyOrWhitespace = true;
} else {
this.value = value ? value.trim() : "";
this.emptyOrWhitespace = this.value === "";
}
};
Combinator.prototype = new Node();
Combinator.prototype.type = "Combinator";
var _noSpaceCombinators = {
'': true,
' ': true,
'|': true
};
Combinator.prototype.genCSS = function (context, output) {
var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';
output.add(spaceOrEmpty + this.value + spaceOrEmpty);
};
module.exports = Combinator;