carto/lib/less/tree/selector.js

26 lines
727 B
JavaScript
Raw Normal View History

if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', '..', 'less', 'tree')); }
2010-02-24 02:39:05 +08:00
tree.Selector = function Selector(elements) {
this.elements = elements;
if (this.elements[0].combinator.value === "") {
this.elements[0].combinator.value = ' ';
}
};
tree.Selector.prototype.match = function (other) {
if (this.elements[0].value === other.elements[0].value) {
return true;
} else {
return false;
}
};
tree.Selector.prototype.toCSS = function () {
2010-02-24 02:39:05 +08:00
return this.elements.map(function (e) {
if (typeof(e) === 'string') {
return ' ' + e.trim();
} else {
return e.toCSS();
}
}).join('');
};