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 }
|
|
|
|
|
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('');
|
|
|
|
};
|
|
|
|
|
2010-06-16 06:44:59 +08:00
|
|
|
})(require('less/tree'));
|