Fix hang around massive stylesheets, fixes mapbox-base

This commit is contained in:
Tom MacWright 2013-01-03 18:43:12 -05:00
parent 4d4abb27b5
commit f0e245183a

View File

@ -198,7 +198,7 @@ carto.Renderer.prototype.render = function render(m, callback) {
};
// This function currently modifies 'current'
function addRules(current, definition, existing, env) {
function addRules(current, definition, byFilter, env) {
var newFilters = definition.filters,
newRules = definition.rules,
updatedFilters, clone, previous;
@ -208,7 +208,7 @@ function addRules(current, definition, existing, env) {
for (var k = 0; k < current.length; k++) {
updatedFilters = current[k].filters.cloneWith(newFilters);
if (updatedFilters) {
previous = existing[updatedFilters];
previous = byFilter[updatedFilters];
if (previous) {
// There's already a definition with those exact
// filters. Add the current definitions' rules
@ -225,6 +225,7 @@ function addRules(current, definition, existing, env) {
// to make sure that in the next loop iteration, we're
// not performing the same task for this element again,
// hence the k++.
byFilter[updatedFilters] = clone;
current.splice(k, 0, clone);
k++;
}