carto/lib/less/tree/selector.js

33 lines
815 B
JavaScript
Raw Normal View History

(function (tree) {
2010-02-24 02:39:05 +08:00
2010-06-19 13:51:26 +08:00
tree.Selector = function (elements) {
this.elements = elements;
2010-12-15 00:16:21 +08:00
this.filters = [];
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;
}
};
2010-06-12 09:45:51 +08:00
tree.Selector.prototype.toCSS = function (env) {
2010-03-10 12:58:05 +08:00
if (this._css) { return this._css }
2010-12-15 00:16:21 +08:00
return this._css = /* this.elements.map(function (e) {
2010-02-24 02:39:05 +08:00
if (typeof(e) === 'string') {
return ' ' + e.trim();
} else {
2010-06-12 09:45:51 +08:00
return e.toCSS(env);
2010-02-24 02:39:05 +08:00
}
2010-12-15 00:16:21 +08:00
}).join('') + */
this.filters.map(function (f) {
return f.toCSS(env);
2010-02-24 02:39:05 +08:00
}).join('');
};
})(require('less/tree'));