carto/lib/mess/tree/selector.js

26 lines
630 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 }
return this._css = this.elements.map(function (f) {
return f.toCSS(env).trim();
}).join('--');
2010-02-24 02:39:05 +08:00
};
2011-01-06 03:23:28 +08:00
})(require('mess/tree'));