2010-06-16 06:44:59 +08:00
|
|
|
(function (tree) {
|
2010-02-24 02:39:05 +08:00
|
|
|
|
2010-06-19 13:51:26 +08:00
|
|
|
tree.Selector = function (elements) {
|
2010-03-06 00:42:13 +08:00
|
|
|
this.elements = elements;
|
2010-12-15 00:16:21 +08:00
|
|
|
this.filters = [];
|
2010-03-06 00:42:13 +08:00
|
|
|
if (this.elements[0].combinator.value === "") {
|
|
|
|
this.elements[0].combinator.value = ' ';
|
|
|
|
}
|
|
|
|
};
|
2010-03-05 02:50:52 +08:00
|
|
|
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 }
|
|
|
|
|
2011-01-04 03:41:41 +08:00
|
|
|
return this._css = this.elements.map(function (f) {
|
2011-01-04 05:35:52 +08:00
|
|
|
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'));
|