28 lines
732 B
JavaScript
28 lines
732 B
JavaScript
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
|
|
|
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 () {
|
|
if (this._css) { return this._css }
|
|
|
|
return this._css = this.elements.map(function (e) {
|
|
if (typeof(e) === 'string') {
|
|
return ' ' + e.trim();
|
|
} else {
|
|
return e.toCSS();
|
|
}
|
|
}).join('');
|
|
};
|
|
|