Merge branch 'master' of github.com:developmentseed/mess.js

This commit is contained in:
Tom MacWright 2011-01-31 17:42:02 -05:00
commit a440e4d95d

View File

@ -254,35 +254,16 @@ mess.Renderer = function Renderer(env) {
// basically if 'this level' has // basically if 'this level' has
// a filter, then keep going, otherwise // a filter, then keep going, otherwise
// this is the final selector. // this is the final selector.
var winners = [];
var ancestors = [];
var belowThreshold = false;
var def;
while (def = definitions.shift()) { for (var i = 0; i < definitions.length; i++) {
if (belowThreshold) { for (var j = i + 1; j < definitions.length; j++) {
ancestors.push(def); definitions[i].inheritFrom(definitions[j]);
} else if (def.selector.specificity()[2] > 0) {
winners.push(def);
} else {
winners.push(def);
// nothing below this level will win
belowThreshold = true;
}
}
for (var i = 0; i < winners.length; i++) {
for (var j = i + 1; j < winners.length; j++) {
winners[i].inheritFrom(winners[j]);
}
for (var j = 0; j < ancestors.length; j++) {
winners[i].inheritFrom(ancestors[j]);
} }
} }
if (env.debug) console.warn('Processing time: ' + ((new Date - processTime)) + 'ms'); if (env.debug) console.warn('Processing time: ' + ((new Date - processTime)) + 'ms');
return winners; return definitions;
}, },
mergeSelectors: function(selectors) { mergeSelectors: function(selectors) {